• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Validating sum total with exactly two possible values, submission as a condition of invalid warning.

New Here ,
Aug 16, 2024 Aug 16, 2024

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!

TOPICS
PDF forms

Views

83

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 17, 2024 Aug 17, 2024

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"});

Votes

Translate

Translate
Community Expert ,
Aug 17, 2024 Aug 17, 2024

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"});

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2024 Aug 17, 2024

Copy link to clipboard

Copied

LATEST

Perfect, thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines