WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
[resolved] Radio button not working when 'required'? (5 posts)

  1. Tux Kapono
    Member
    Posted 1 year ago #

    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/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. Tux Kapono
    Member
    Posted 1 year ago #

    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.

  4. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

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

    Checkboxes, Radio Buttons and Menus

  5. Tux Kapono
    Member
    Posted 1 year ago #

    Thanks for the feedback. I appreciate it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.