I am trying to: get a post form to submit with a check on two required checkboxes(as generic fields).
Link to a page where the issue can be seen: It is still under developmen.
I expected to see: A form submitted and an entry created in the backend.
Instead, I got: An error message saying the fields are not checked. And the form reloads with the boxes unchecked again, and nothing is saved.
Hi, can you give me a bit more information?
- Do you have any custom validation code in place to check these generic checkbox values, e.g., a cred_form_validate hook? If so, please include that code in your next reply.
- Are you using the drag-and-drop form builder to create this Form, or using shortcodes in the expert Form builder?
- If you're using drag-and-drop, please take screenshots of the field configurations for each generic checkbox field and include them in your next reply
- If you're using expert mode, can you copy + paste the the generic field shortcodes in your next reply?
Hi Christian, thanks for your reply. About the information you asked about. I have used the drag and drop editor to add the fields. I have included the setup in the screens.
The code from expert mode(uneditted form the drag and drop builder) is:
<div class="form-group">
<label>[cred_i18n name='generic-filed-akkoord-algemene-voorwaarden-label']Ik ga akkoord met de hidden link">algemene voorwaarden[/cred_i18n]</label>
[cred_generic_field type='checkbox' field='akkoord-algemene-voorwaarden']
{
"required":1,
"default":""
}
[/cred_generic_field]
</div>
<div class="form-group">
<label>[cred_i18n name='generic-filed-akkoord-privacy-policy-label']Ik ga akkoord met de hidden link">privacy policy[/cred_i18n]</label>
[cred_generic_field type='checkbox' field='akkoord-privacy-policy']
{
"required":1,
"default":""
}
[/cred_generic_field]
</div>
Thank you, in this case you should add a value of 1 for each generic checkbox field. Without a value of 1, the checked checkbox will never register as being checked. Please add a value of 1 in the Standaard veldwaarde field for each checkbox and test again.
Hi Christian,
thank you for your reply! I will check it out. It sounds logical and simple.
Kind regards,
Glenn Windhouwer