0
New Here
,
/t5/acrobat-discussions/if-greater-than-multiple-by/td-p/14856213
Sep 12, 2024
Sep 12, 2024
Copy link to clipboard
Copied
I am trying to create a pdf javaScript formula that calculates if a field is greater than 2 multiple that field's value by 25 but not to exceed $250
TOPICS
Create PDFs
,
JavaScript
,
PDF
,
PDF forms
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 ACCEPTED SOLUTION
Community Expert
,
/t5/acrobat-discussions/if-greater-than-multiple-by/m-p/14856366#M478502
Sep 12, 2024
Sep 12, 2024
Copy link to clipboard
Copied
Use the following custom calculation script:
var fld=this.getField("theField").value;
if(fld>2)
{event.value=fld*25}
else
{event.value=""}
if(event.value>250)
{event.value=250}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/acrobat-discussions/if-greater-than-multiple-by/m-p/15055262#M490825
Dec 23, 2024
Dec 23, 2024
Copy link to clipboard
Copied
NB. Line-breaks don't matter, if you include a semi-colon after each line, but it's good practice to properly format your code with line-breaks and indentations.
NBB. This is JavaScript, not Java. Similar names, but quite different languages...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more


-
- 1
- 2