11. Checkboxes, radio buttons, and menus

Created by Danny Wong, Modified on Sun, 9 Aug, 2020 at 3:39 PM by Danny Wong

  1. Contact Form 7 provides several types of form-tags for representing checkboxes, radio buttons, and drop-down menus. This article explains about the usage and semantics of these form-tags.

  2. Checkboxes and radio buttons#Checkboxes and radio buttons

  3. Both checkbox and checkbox* represent a group of checkboxes (<input type="checkbox"> in HTML). checkbox* requires the user to select at least one of the boxes.
  4. radio represents a group of radio buttons (<input type="radio"> in HTML). Because a group of radio buttons is naturally required, a radio form-tag works as a required field. It is advised to preselect an option in a radio button group using the default:1 option.
  1. OPTION
  1. EXAMPLES
  1. DESCRIPTION
  1. id:(id)
  1. id:foo
  1. id attribute value of the wrapper element.
  1. class:(class)
  1. class:bar
  1. class attribute value of the wrapper element. To set two or more classes, you can use multiple class: option.
  1. default:(num)
  1. default:2
  2. default:1_2_3
  1. 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.
  1. label_first
  1.  
  1. By default, a checkbox or a radio button are put first, and a label last. By adding label_first option, you can reverse them.
  1. use_label_element
  1.  
  1. Wrap each checkbox and radio button with <label> tag.
  1. exclusive
  1.  
  1. 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.
  1. free_text
  1.  
  1. Append a free input text field to the last item.
  1. data:(name)
  1. data:countries
  1. Get the values from Listo.
  1. These types of tags have one or more values, and the values will be used as the values and labels of the checkboxes or radio buttons.
  2. Example:
  3. [checkbox your-country "China" "India" "San Marino"]
  4. Drop-down menus#Drop-down menus

  5. Both select and select* represent a drop-down menu (<select> in HTML). select* requires the user to select at least one option from the menu.
  1. OPTION
  1. EXAMPLES
  1. DESCRIPTION
  1. id:(id)
  1. id:foo
  1. id attribute value of the select element.
  1. class:(class)
  1. class:bar
  1. class attribute value of the select element. To set two or more classes, you can use multiple class: option.
  1. default:(num)
  1. default:2
  2. default:1_2_3
  1. 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.
  1. multiple
  1.  
  1. Make the drop-down menu multi-selectable.
  1. include_blank
  1.  
  1. Insert a blank item into the top of options of this drop-down menu.
  1. first_as_label
  1.  
  1. Use the first value as a label.
  1. data:(name)
  1. data:countries
  1. Get the values from Listo.
  1. These types of tags have one or more values, and the values will be used as options in the drop-down menu.
  2. Example:
  3. [select your-country "China" "India" "San Marino"]
  4. Demo#Demo

  5. Note: This is a demo form and it doesn’t send an email practically.

  1. Select Country (required)
    ChinaIndiaSan Marino
  2. Select Sports
    FootballTennisPole-vault
  3. Select Fruit (required)
    AppleBananaGrape
  4. Select Browser (required)
    ---FirefoxSafariOperaLynx
  5. Select Ghkdsjdf
    fsdfsklgjfkvdrie
  1. View source of the preceding form:
  2. Select Country (required)
    [checkbox* your-country use_label_element "China" "India" "San Marino"]
    
    Select Sports
    [radio your-sports label_first default:2 "Football" "Tennis" "Pole-vault"]
    
    Select Fruit (required)
    [checkbox* your-fruit exclusive "Apple" "Banana" "Grape"]
    
    Select Browser (required)
    [select* your-browser include_blank "Firefox" "Safari" "Opera" "Lynx"]
    
    Select Ghkdsjdf
    [select your-ghkdsjdf multiple "fsdfs" "klgjfk" "vdrie"]
    
    [submit "Send"]

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article