I have some fields hidden [required fields] in WFFM forms based on checkbox selection. My requirement is it should allow forms to submit while those fields hidden.If it should validate required field if those field display. My jquery validation js file have default setting ignore:hidden option. But still while submit it refreshing my page and not submitting and validating those hidden field and shows error message. Can you please guide how to solve this problem. I am using sitecore 8 WFFM update 4.
To achieve "conditional required fields", you need to:
- not set the fields as required in WFFM
- have a custom JS to do client-validation
- have a custom WFFM form validator that checks for conditionally required fields
In case you need this often in many different forms, you should try to add some extra attributes (e.g.
fieldRequierementClass) so the js and WFFM can read from this, if it's just one static form you're probably better of to just hardcode everything. I didn't do research if someone build a module or something for this in the meantime, I'm just relaying experience from a past project.