Expand my Community achievements bar.

how to validate the form while saving it?

Avatar

Former Community Member

Hi

I have some required fields in the form, the "field cannot be left blank" error fires while filling up the pdf, which causes concern as we are not really sure when exactly it is firing.

Can we validate all the fields at once while saving or submitting the form?

and also is there any direct method as we want to avoid writing code manually for every field?

Thanks

Abhiram

2 Replies

Avatar

Level 10

Hi,

please check this article.

It explains the usage of the validate element for prePrint, preSave, preSubmit... events.

http://forms.stefcameron.com/2008/04/13/prevent-printing-pdf-forms-in-acrobat-8/

Avatar

Level 9

Hi Abhiram,

If the requried field (Those fields having the red border) are blank while submitting then it would throw an error that these fields can not be left blank.

In the click event of the SaveAs and/or Submit button you can write some scripts so that it would first check the validation of the fields, if all the fields are validated then it would carry out the required operation. If not, then it would alert the user.

For ex : In the click event of SaveAs button you can try the following.

if (form1.Page1.Page1_subform1.execValidate())

{

   app.execMenuItem("SaveAs");

}

else

{

}

You can directly write one code which would validate the entire form. Here I have given the example of a subform. If you want to validate few fields in a particular subform you can use this. Else you can try with form1.execValidate() function.

Thanks.

Bibhu.