Skip Navigation

[Resolved] Generic checkbox for ‘privacy policy’ and ‘terms and conditions’ not saving.

This thread is resolved. Here is a description of the problem and solution.

Problem: I have two required generic checkbox fields in a Form. When I submit the Form with the checkboxes checked, I receive an error saying that required checkboxes fields are not checked.

Solution: Ensure a default value of 1 is applied to required checkbox fields. Otherwise the validation script will fail to validate checked checkboxes.

This support ticket is created 4 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by glenn 4 years ago.

Assisted by: Christian Cox.

Author
Posts
#1842249
Capture.JPG

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.

#1842343

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?

#1843235
Capture2.JPG
Capture1.JPG

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>

#1844957

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.

#1853697

Hi Christian,

thank you for your reply! I will check it out. It sounds logical and simple.

Kind regards,

Glenn Windhouwer