Conditional Fields clearing On Submit

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Jdubs
Posts: 73
Joined: Fri Dec 19, 2014

24 Jun 2015

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!

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

25 Jun 2015

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();

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 21 guests