Support » Plugin: Contact Form 7 » Radio button not working when 'required'?

  • Resolved Tux Kapono

    (@tux-kapono)


    This is rather curious, and confounding. Look at how the following lines of code, especially the two ones on ‘Gender’:

    <p>Full Name (required)<br />
    [text* name] </p>
    
    <p>Gender (required)<br />
    [radio* gender "Female" "Male"]
    
    <p>Gender (required)<br />
    [radio gender "Female" "Male"]
    
    <p>Mailing Address (Street, City/State, Zip Code required)<br />
    [textarea* address x6] </p>
    
    <p>Email (required)<br />
    [email* email] </p>

    …show up on the page: http://renovarhempstead.com/solicitud-de-empleo/

    Why is it that when radio is required with the *, it doesn’t show up? As you can see, it works fine for the others.

    http://wordpress.org/extend/plugins/contact-form-7/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    It is because radio* doesn’t exist.

    Checkboxes, Radio Buttons and Menus

    radio represents a group of radio buttons (<input type="radio"> in HTML). Note that there is no required version of radio (“radio*”). The reason Contact Form 7 doesn’t provide “radio*” is because a radio button is a required field by nature. The HTML spec document explains it more in detail.

    Thanks Takayuki, I’d like the option of the ‘Please fill in the required field’ prompt popping up when the user hits ‘Submit’ when neither of the radio buttons are selected, like for gender.

    Currently, people are allowed to skip the question and that can’t be an option for us. Filling in one of the genders beforehand is just plain weird, but it looks like that’s the only option.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    You can use checkbox* with exclusive option for such cases.

    Checkboxes, Radio Buttons and Menus

    Thanks for the feedback. I appreciate it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Radio button not working when 'required'?’ is closed to new replies.