Expand my Community achievements bar.

How can you ensure all mandatory fields are filled, before pressing the submit button?

Avatar

Level 4
Hi all,



I've got a complex form with many different pages (17 so far) and I'm using visible/hidden to change the layout so only 1 page appears at a time.



What I want to do is have a better check for what mandatory fields have not been filled out in my form. The submit buttons checks that all of the mandatory fields have been completed, but if that's 1 field on page 1, searching through my entire document would cause the users to lose the will to live!



I am after either returning more meaningful information to the user when a submit fails, or being able to run the mandatory check field every time the page changes. I already dynamically set most of the mandatory fields according to what is/isn't visible so adapting my form wouldn't take long but I have no idea how to get it to check if all the fields have been filled in.



Many thanks,



Tom
3 Replies

Avatar

Former Community Member
On the turn of a page force the validations to fire for that page. You can use the form1.Page1.execValidate(). This will cause all validate scripts to run on Page 1.

Avatar

Level 4
Ahah, many thanks Paul.



You're a star as always!

Avatar

Level 4
Right, I have pretty much all of my validations working now... and here's the word you're waiting for... but, I am having a problem with fields that are already visible when the rest of the layout changes.



Basically, one of the options above the field with the problem is being changed, which makes the layout above that field change. This is triggering the validate event.



This wouldn't stop anyone using my form, but it is an annoyance.



Anyone able to help?



Many thanks,



Tom