Prevent user from going to next page until text fields are filled out. Ideas/Suggestions?

BGreggs4

12-02-2016

Working with a Client who would like all fields on a page to be filled out before proceeding to the next page. Any thoughts or suggestions that I can do for this? Normally in the past I let the "submit" button at the end do the validation, but this I am not sure how to approach this. Thanks!

Accepted Solutions (0)

Answers (4)

Answers (4)

BGreggs4

18-02-2016

Ended up hiding all the pages (except page one) and placed a button on each page that validated only that page. Once that page was validated it opened up Page 2. This was the code I used for the Page 1 button in case folks want to know.

if(Page1.execValidate() == false)

{

  xfa.event.cancelAction = true;

}

else

{

  xfa.event.cancelAction = false;

  Page2.presence = "visible";

  Page3.presence = "hidden";

  Page4.presence = "hidden";

  Page5.presence = "hidden";

  Page6.presence = "hidden";

  Page7.presence = "hidden";

  Page8.presence = "hidden";

  Page9.presence = "hidden";

  Page10.presence = "hidden";

}

Magus069

MVP

12-02-2016

execValidate() validates each fields that are set to mandatory, even if they are hidden in background.

So if you have mandatory fields in page 2, you will never be able to verify only page1, unless you modify the mandatory property for each fields...

the validate function I provided is doing the same as execValidate(), but it does not validate hidden fields and can validate some parts of the PDF Form.

you could probably use execValidate() only when submitting the form, or remove all mandatory fields and make your own validation

BGreggs4

12-02-2016

Currently have fields on Page 1 set to Required and have an "Error Message" for each of them. Trying to throw up an error message before the user goes to Page 2. I know you mentioned the checkbox and add a calculation in the calculate event, but not sure exactly what to use. I know that there is the execValidate(), and wonder if somehow that might work? Not sure.

Magus069

MVP

12-02-2016

Hi there,

you can simply have a checkbox hidden in background with script within the calculate event, which will validate parts of the form that you specifically want it to be filled.

Once the check box has the value checked, you can simply put the other parts to visible.

Depending on how many information that needs to be validated you can validate it field by field or you can try using my validation script provided within the following thread :

Validation / Reset Functions, easy to manipulate and to change Forms!!!!

The validation script is to validate each fields that are visible according to the part of the form you provided in parameter to the function.

There is also an exception array which you can enter field's names or subform's names which you don't want to validate.

I hope this will help.