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

Creating Expense Form with either or fields

New Here ,
Aug 26, 2020 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

Views

42

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
Enthusiast ,
Aug 26, 2020 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
community guidelines
Community Expert ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

LATEST

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
community guidelines