Conditional Fields clearing On Submit
I have conditionally-revealed fields based on user selection.
Everything works great, BUT ... if a user Submits the form with a Required field blank, it gives the user an error (as intended) but then HIDES all the conditionally-revealed fields (while keeping the field values the same ... so the fields should still be revealed).
Any way to fix this? It's a lot of code ... I don't want to have to Copy and Paste all my code in the on.submit handler just to keep my fields available.
Thanks!
Everything works great, BUT ... if a user Submits the form with a Required field blank, it gives the user an error (as intended) but then HIDES all the conditionally-revealed fields (while keeping the field values the same ... so the fields should still be revealed).
Any way to fix this? It's a lot of code ... I don't want to have to Copy and Paste all my code in the on.submit handler just to keep my fields available.
Thanks!
You can move your code that hides/unhides fields into a separate function. Call this function whenever it is required, i.e. in your handlers as well as when the form is loaded:
Code: Select all
function hideUnhideFields() {
// your logic here
}
// When a field has been changed
fd.field('Field1').change(function() { hideUnhideFields() })
// When a form is loaded:
hideUnhideFields();
-
- Information
-
Who is online
Users browsing this forum: No registered users and 19 guests