I have two elements on form:
Element 1: Checkbox with the label "Do you want tell me your age?"
Element 2: Text field with the label "Please type in your age now"
I've set a JavaScript, that element 2 is only visible, if element 1 is checked.
I've set a validation, that element 2 should not be empty.
But if element 1 os not checked, and user is trying to save the form data, then the valisation says element 2 must not be empty.
How can i set a condition to the validation, that element 2 should not be empty, if element 2 is checked only. If element 1 is not checked, then this validation should be ignored.
Could someone give me an example?
Element 1: Checkbox with the label "Do you want tell me your age?"
Element 2: Text field with the label "Please type in your age now"
I've set a JavaScript, that element 2 is only visible, if element 1 is checked.
I've set a validation, that element 2 should not be empty.
But if element 1 os not checked, and user is trying to save the form data, then the valisation says element 2 must not be empty.
How can i set a condition to the validation, that element 2 should not be empty, if element 2 is checked only. If element 1 is not checked, then this validation should be ignored.
Could someone give me an example?