NEED HELP WITH JAVASCRIPT IF STATEMENTS

New Here ,
Jul 03, 2020

Copy link to clipboard

Copied

I need to calculate the following in FieldC calculation.

IF FIELDA is greater than FIELDB then FIELDB value goes into FIELDC.

 

Can anyone help me do this??

 

you're help would be greatly appreciated.

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

72

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

NEED HELP WITH JAVASCRIPT IF STATEMENTS

New Here ,
Jul 03, 2020

Copy link to clipboard

Copied

I need to calculate the following in FieldC calculation.

IF FIELDA is greater than FIELDB then FIELDB value goes into FIELDC.

 

Can anyone help me do this??

 

you're help would be greatly appreciated.

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

73

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
Jul 03, 2020 0
Adobe Community Professional ,
Jul 03, 2020

Copy link to clipboard

Copied

Hi,

 

You would need to use something like :

 

var FIELDA = this.getField ("FIELDA").value;

var FIELDB = this.getField("FIELDB").value;

if ( FIELDA > FIELDB) {

    this.getField("FIELDC").value = FIELDB;

}

 

This is just a quick example.

 

Regards

 

Malcolm

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...
Jul 03, 2020 1
New Here ,
Jul 12, 2020

Copy link to clipboard

Copied

Thank you for helping me out but I guess I didn't add that if FieldA is less than or equal to FieldB then the value in FieldC should be the value of FieldA.

 

Could you help me with that.

 

And, would you know how to validate a field so that if the amount input is greater than another specified field it would show an error and not allow the input.

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...
Jul 12, 2020 0
Most Valuable Participant ,
Jul 03, 2020

Copy link to clipboard

Copied

What about if it's not, though?

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...
Jul 03, 2020 1