Text Field Properties

New Here ,
Apr 02, 2020 Apr 02, 2020

Copy link to clipboard

Copied

How do you create a maximum on a fomula.

Expense sheet

10.00 Breakfast

10.00 Lunch

10.00 Dinner

Max calculation $25.00 

TOPICS
Acrobat SDK and JavaScript

Views

1.0K

Likes

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
Most Valuable Participant ,
Apr 03, 2020 Apr 03, 2020

Copy link to clipboard

Copied

You need to use a script for that.

Assuming you're adding up those three fields you can use something like this as the custom calculation script of your field:

 

var total = Number(this.getField("Breakfast").valueAsString) + Number(this.getField("Lunch").valueAsString) + Number(this.getField("Dinner").valueAsString);

event.value = Math.min(25, total);

Likes

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 ,
Apr 03, 2020 Apr 03, 2020

Copy link to clipboard

Copied

hello

 

Likes

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 ,
Apr 03, 2020 Apr 03, 2020

Copy link to clipboard

Copied

Sorry, I was off for the day. This is all so new to me and yes that is what I want to do, so I tried this and I must have something wrong.



My fields are Bday1, LDay1 and DDay1

and the total field is TotalDay1



So this is what I have however it is not working.



var total = Number(Bday1("Breakfast").valueAsString) + Number(LDay1("Lunch").valueAsString) + Number(DDay1("Dinner").valueAsString);

event.value = Math.min(25, total);

Thank you so much for your help.
[Private info removed]

Likes

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
Most Valuable Participant ,
Apr 03, 2020 Apr 03, 2020

Copy link to clipboard

Copied

Do not reply by email! It includes your full contact details and posts them to this public forum, which is not a good idea. I will remove them from the message above for you.

Likes

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
Most Valuable Participant ,
Apr 03, 2020 Apr 03, 2020

Copy link to clipboard

Copied

The only thing you need to adjust in the code I provided are the names of the fields inside the quotes.

Likes

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 ,
Apr 03, 2020 Apr 03, 2020

Copy link to clipboard

Copied

LATEST

Thank you so very much. 

 

Likes

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