WordPress.org

Forums

Contact Form 7
Make an HTML select field required in CF7 (1 post)

  1. Amr Kamel
    Member
    Posted 1 year ago #

    Hi there,

    I have a working form with a country and city drop down menus using onChange event, my problem is I can't get these drop down menus to be required as the rest of the fields. I can only make a field with square brackets [] required by placing the "*" but a normal brackets field <> doesn't approve the "*" thing.

    Here is my CF7 form code:

    <h4>Name</h4><br />
        [text* your-name]
    <h4>Birth date</h4><br />
        [date* Date date-format:dd/mm/yy]
    <h4>Country</h4><br />
    <select name="country" id="country" onchange="cityChange(this);">
        <option value="empty">Select a country</option>
        <option value="EG">Egypt</option>
        <option value="JR">Jordan</option>
    </select>
    <h4>City</h4><br />
    <select name="city" id="city">
        <option value="0">Select a city</option>
    </select>
    <h4>Email</h4><br />
        [email* your-email]
    <h4>Mobile Number</h4><br />
        [tel* Mobile]
    <h4>Optional Notes</h4><br />
        [textarea Notes 60x3/1000 placeholder "Need to tell us anything else?"]
    <br />
    <p>[submit "Register ยป"]</p><br />

    Thanks a lot in advance.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic