help to modify Javascript

Explorer ,
Mar 19, 2018

Copy link to clipboard

Copied

hi, i'm using bellow calculating script & it's working. what i want to do is, if any of field is empty, calculation result field should be empty. pls help me. thanks in advance. thanks..

var v1 = Number(this.getField("amt11").value); 

var v2 = Number(this.getField("EX").value);

if (v1==0) event.value = ""; 

else event.value = v1/v2;

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

Just add all fields to the existing "if" statement

Like this:

var v1 = Number(this.getField("amt11").value);

var v2 = Number(this.getField("EX").value);

if ((v1==0)  || (v2==0)) event.value = "";

else event.value = v1/v2;

TOPICS
Acrobat SDK and JavaScript, Windows

Views

44

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

help to modify Javascript

Explorer ,
Mar 19, 2018

Copy link to clipboard

Copied

hi, i'm using bellow calculating script & it's working. what i want to do is, if any of field is empty, calculation result field should be empty. pls help me. thanks in advance. thanks..

var v1 = Number(this.getField("amt11").value); 

var v2 = Number(this.getField("EX").value);

if (v1==0) event.value = ""; 

else event.value = v1/v2;

Adobe Community Professional
Correct answer by Thom Parker | Adobe Community Professional

Just add all fields to the existing "if" statement

Like this:

var v1 = Number(this.getField("amt11").value);

var v2 = Number(this.getField("EX").value);

if ((v1==0)  || (v2==0)) event.value = "";

else event.value = v1/v2;

TOPICS
Acrobat SDK and JavaScript, Windows

Views

45

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
Mar 19, 2018 0
Adobe Community Professional ,
Mar 19, 2018

Copy link to clipboard

Copied

Just add all fields to the existing "if" statement

Like this:

var v1 = Number(this.getField("amt11").value);

var v2 = Number(this.getField("EX").value);

if ((v1==0)  || (v2==0)) event.value = "";

else event.value = v1/v2;

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...
Mar 19, 2018 0
omanbux LATEST
Explorer ,
Mar 19, 2018

Copy link to clipboard

Copied

https://forums.adobe.com/people/Thom+Parker  wrote

Just add all fields to the existing "if" statement

Like this:

var v1 = Number(this.getField("amt11").value);

var v2 = Number(this.getField("EX").value);

if ((v1==0)  || (v2==0)) event.value = "";

else event.value = v1/v2;

thanks a lot & it's work. thanks..

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...
Mar 19, 2018 0