Highlighted

Creating Expense Form with either or fields

New Here ,
Aug 26, 2020

Copy link to clipboard

Copied

I want each line to either have mileage or an expense amount, but not both.

I have the total for the line to calculate mileage value if there is an amount in the mileage column or put in the amount spent, but I want to limit the user to only putting a value in one column or the other.

Columns in form are:

Date, Description, Miles, Amount, GL Account, Total

Miles and Account are formatted as numbers.

My total column calculation if then script works but does not prevent using both.

 

TOPICS
Acrobat SDK and JavaScript, How to

Views

27

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

Creating Expense Form with either or fields

New Here ,
Aug 26, 2020

Copy link to clipboard

Copied

I want each line to either have mileage or an expense amount, but not both.

I have the total for the line to calculate mileage value if there is an amount in the mileage column or put in the amount spent, but I want to limit the user to only putting a value in one column or the other.

Columns in form are:

Date, Description, Miles, Amount, GL Account, Total

Miles and Account are formatted as numbers.

My total column calculation if then script works but does not prevent using both.

 

TOPICS
Acrobat SDK and JavaScript, How to

Views

28

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
Aug 26, 2020 0
Contributor ,
Aug 26, 2020

Copy link to clipboard

Copied

Can you share file or photo of your fields?

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
Reply
Loading...
Aug 26, 2020 0
try67 LATEST
Most Valuable Participant ,
Aug 26, 2020

Copy link to clipboard

Copied

The way to achieve that is to have each field reset the value of the other when filled. Let's say they are called Miles1 and Amout1. As the custom validation script of Miles1 enter:

if (event.value) this.resetForm(["Amount1"]);

And under Amount1 enter:

if (event.value) this.resetForm(["Miles1"]);

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
Reply
Loading...
Aug 26, 2020 0