Skip to main content
Participant
April 4, 2018
Question

PDF Forms - Submit Button

  • April 4, 2018
  • 1 reply
  • 451 views

Is there a way to set the submit form button to not submit if the completed form contains no deficiencies?  Example:  If a deficiency is indicated by a Yes answer [radio button], and the form contains no Yes answers.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
April 4, 2018

Yes, you can use a script to validate that at least one Yes answer is selected before submitting the form.

K FreemanAuthor
Participant
April 4, 2018

Thank you!  I have very limited experience with validation scripts.  Are you able to point me in the right direction to find that information?  I'm going to start looking, but thought I would ask in the interest of saving time. 

try67
Community Expert
Community Expert
April 4, 2018

Here's a simple version of such a script. Note it's not a validation script, per se. You will need to use it as the Mouse Up event of your Submit button.

var allGood = false;

if (this.getField("Deficiency1").valueAsString=="Yes") allGood = true;

if (this.getField("Deficiency2").valueAsString=="Yes") allGood = true;

if (this.getField("Deficiency3").valueAsString=="Yes") allGood = true;

if (allGood) {

    this.submitForm({cURL: "mailto:me@server.com", cSubmitAs: "PDF"});

} else{

     app.alert("You must answer Yes to at least one of the Deficiency fields.",1);

}