3

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.

3

Currently in WFFM, this is not possible without custom JavaScript. You will need to disable validation on the fields you want to validate. Then write custom client side validation when the field is visible.

0

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. requiresFieldsOfClassIfChecked and 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.