Forums

Optional validation + validation by event

jj135 18 Sep, 2017
Hi! On a form I have an optional e-mail field. Only when someone enters some text here I need it to validate the filled in e-mailaddress. So I check did not check 'Required' , but I did check the option 'Optional' on the validation tab. This works fine.

But I also have a checkbox 'Newsletter'. And when this is checked I want the e-mail 'required' to activate.

To accomplish this I check 'Disabled' on the e-mail field validation tab. And on the checkbox events tab I created an event to activate the validation on the email when it is checked. This also seems to work OK.

But because the validation is 'Disabled' on the e-mail field, the 'Optional' doesn not work anymore. So when someone does not check the newsletter box, the validation is not turned on and it is also nog validatied when some types in a value.

How do I achieve this:
- Newsletter box checked: Email field validation ON
- Newsletter box not checked: Email validation OPTIONAL (only when not empty)

Or can this not be done? Or is there an alternate way?

Kind regards,
Jip
jj135 18 Sep, 2017
Hi! For the form I am currently working we changed the setup so this question is no longer relevant for our current project. We know only need the email field when the checkbox is filled in. And when it is, it also needs to validate. This works fine with 'email' validation set to 'Disabled' and turning it on with the checkbox event.

Still, I would like to know if the scenario from my original post can be done?
This topic is locked and no more replies can be posted.