How can I prevent saving a form if there are required items empty? | Community
Skip to main content
Gotterkraft
July 21, 2021
Solved

How can I prevent saving a form if there are required items empty?

  • July 21, 2021
  • 1 reply
  • 1848 views

I have a form which has both text fields and drop downs that are required to fill out.  The problem is people can still save the document even though the required items are left blank.  How can I prevent someone from saving the form and not leave any of those requirements blank?

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Pulkit_Jain_

@gotterkraft 

Ideally, when you set the form objects as Required i.e "Type: User entered required" in a PDF Form then ideally, the user won't be able to submit the form without filling the required fields.

In your case, if this is a requirement then you can put your validation code[0] on preSave event to warn the user that the form is not complete. Please be informed that this may just notify them if there are any missing fields, not stop them from saving.

Just another tip, all required fields are marked as <validate nullTest="error"/> in the XML source.

 

[0]- 

Page1.execValidate();

 

1 reply

Pulkit_Jain_
Adobe Employee
Pulkit_Jain_Adobe EmployeeAccepted solution
Adobe Employee
July 21, 2021

@gotterkraft 

Ideally, when you set the form objects as Required i.e "Type: User entered required" in a PDF Form then ideally, the user won't be able to submit the form without filling the required fields.

In your case, if this is a requirement then you can put your validation code[0] on preSave event to warn the user that the form is not complete. Please be informed that this may just notify them if there are any missing fields, not stop them from saving.

Just another tip, all required fields are marked as <validate nullTest="error"/> in the XML source.

 

[0]- 

Page1.execValidate();