要在 Contact Form 7 使用下拉式選單(select)的話可以像這樣寫:
[select your-country "China" "India" "San Marino"]
第二個參數一樣可以把值透過 email 傳出去,後面幾個則是可以設定下拉式選單的選項。
完整的參數設定如下:
Option | Examples | Description |
---|---|---|
id: (id) |
id:foo |
id attribute value of the select element. |
class: (class) |
class:bar |
class attribute value of the select element. To set two or more classes, you can use multiple class: option. |
default: (num) |
default:2 default:1_2_3 |
Preselected options. The integer following default: is the position in the order of items. 1 is the first one. If you want to make two or more items selected, joint integers with underbar (_), as default:1_2_3 . |
multiple |
Make the drop-down menu multi-selectable. | |
include_blank |
Insert a blank item into the top of options of this drop-down menu. | |
first_as_label |
Use the first value as a label. | |
data: (name) |
data:countries |
Get the values from Listo. |
checkbox 及 radio 很像,差在前面的類型不一樣而已。
[checkbox your-country "China" "India" "San Marino"]
完整的參數如下:
Option | Examples | Description |
---|---|---|
id: (id) |
id:foo |
id attribute value of the wrapper element. |
class: (class) |
class:bar |
class attribute value of the wrapper element. To set two or more classes, you can use multiple class: option. |
default: (num) |
default:2 default:1_2_3 |
Preselected options. The integer following default: is the position in the order of items. 1 is the first one. If you want to make two or more items selected, joint integers with underbar (_), as default:1_2_3 . |
label_first |
By default, a checkbox or a radio button are put first, and a label last. By adding label_first option, you can reverse them. |
|
use_label_element |
Wrap each checkbox and radio button with <label> tag. |
|
exclusive |
Make checkboxes exclusive. This means, when you select a checkbox in a group, others will be cleared, so the group accepts the zero-selected or one-selected state only. This is a JavaScript gimmick so doesn’t work without JavaScript. radio form-tags don’t support this option. |
|
free_text |
Append a free input text field to the last item. | |
data: (name) |
data:countries |
Get the values from Listo. |
可以參考文件看完整說明:
Checkboxes, radio buttons, and menus