Home › Toolset Professional Support › [Resolved] Checkboxes generic field is not showing required message
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 |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Kolkata (GMT+05:30)
I have made a user form. There is a part for checkboxes in a generic field. This is the code:
[cred_generic_field type='checkboxes' field='welke-voorkeursdagen'] { "required":1, "default":[], "persist":1, "options":[ {"value":"1","label":"Maandagochtend"}, {"value":"2","label":"Maandag middag"}, {"value":"3","label":"Dinsdagochtend"}, {"value":"4","label":"Dinsdagmiddag"}, {"value":"5","label":"Woensdagochtend"}, {"value":"6","label":"Woensdagmiddag"}, {"value":"7","label":"Donderdagochtend"}, {"value":"8","label":"Donderdagmiddag"}, {"value":"9","label":"Vrijdagochtend"}, {"value":"10","label":"Vrijdagmiddag"} ] } [/cred_generic_field]
It is not showing me the This is required message. Is there something wrong with this code?
Marco
Hello. Thank you for contacting the Toolset support.
To validate the checkboxes field, you will have to use the server side validation hook "cred_form_validate":
- https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate
Following example may help you, you can adjust the code for field names etc.. as required.
- https://toolset.com/documentation/programmer-reference/adding-custom-code/require-at-least-one-checkbox-of-a-checkboxes-field-to-be-checked-in-a-toolset-form/