Copy link to clipboard
Copied
I am trying to create a fillable form. There is an optional section where the user can pick percentages for each choice. I would like the invalid warning to pop up only on the conditions that: 1) The user enters a total that is neither 0 nor 100 and 2) The user tries to submit the form. Any help would be appreciated. Thank you!
Assuming the name of the total field is "Total", you can use this code as the Mouse Up script of your Submit button (instead of the current command, not alongside it!):
var total = Number(this.getField("Total").valueAsString);
if (total!=0 && total!=100) {
app.alert("The total must equal 100 or 0 before the file can be submitted.",1);
} else this.mailDoc({cTo: "email@server.com"});
Copy link to clipboard
Copied
Assuming the name of the total field is "Total", you can use this code as the Mouse Up script of your Submit button (instead of the current command, not alongside it!):
var total = Number(this.getField("Total").valueAsString);
if (total!=0 && total!=100) {
app.alert("The total must equal 100 or 0 before the file can be submitted.",1);
} else this.mailDoc({cTo: "email@server.com"});
Copy link to clipboard
Copied
Perfect, thank you!