• Hi All,
    Finally I managed to add conditional fields with this piece of code

    <input name="chkCheckbox" type="checkbox" onclick="if (this.checked) { document.getElementById('div1').style.display='block' } else { document.getElementById('div1').style.display='none' } "/>Add additional booking
    
    <div id="div1" style="display:none">
    <h4>Booking 2</h4>
    <p>Details (required): [textarea textarea-129]</p>
    <p>Start date (required): [date* date-940 date-format:mm/dd/yy]</p>
    <p>Start time (required): [time* time-197 time-format:HH:mm] </p>
    </div>

    Now the problem is that I want them to be required but only if user checked this service. At the moment if they are required even if the user did not checked them form cannot be validated and screams fill required fields.
    Also how to include them to message body only when inputs has been filled?
    Can anyone help please?
    xx
    Anika

  • The topic ‘Contact form 7 conditional fields – how to mek them required only if checked’ is closed to new replies.