Forums

conditional validation

ernst@volny.cz 29 Jul, 2019
How can I verify a non-empty field only if another field is not empty? If the first field is empty, the second field is not verified.
ernst@volny.cz 30 Jul, 2019
I do not know whether I have explained this clearly.
https://jmp.sh/I2x3Mxx
if field 1 is completed, field 2 must also be completed
GreyHead 31 Jul, 2019
Hi Ernst,

I'm not sure exactly how this works in CFv6 - you should be able to hide or disable the second field and unhide or enable it using the Events tab of the first one.

Bob
healyhatman 31 Jul, 2019
Use a field event on the first field to either enable or disable validation on the second field. There are options in there for firing an event on empty / not empty
ernst@volny.cz 31 Jul, 2019
Thank you for the answer, but how do I do it?
healyhatman 31 Jul, 2019
Well if you have a look (the Field Events demo is good for this) there's an "events" tab in the field settings. For your first field for example you can use the "not empty" setting in the dropdown, with the events 'show' and 'enable validation', and the target should be the name of your second field. Do the opposite for the 'empty' setting.
ernst@volny.cz 31 Jul, 2019
Thank you, I will try and let the result know.
This topic is locked and no more replies can be posted.