Don't not calculate if a field is blank

New Here ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

I have two fields in my form. I type in the 1st field a dollar amount I want it to add $10 from the first field in a 2nd field. ( this part I can do). My problem is that if nothing is written in the first field I don't want the calculation performed in the 2nd field.

 

I hope this makes sense. Thanks for your time.

TOPICS
PDF forms

Views

29

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 ,
Sep 22, 2022 Sep 22, 2022

Copy link to clipboard

Copied

You want to add 10 to the amount in first field?

Let's say your fields are named "Field1" and "Field2", as custom calculation script of "Field2" use this:

var f1 = Number(this.getField("Field1").value);
if(f1)
event.value = f1+10;
else
event.value = "";

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 ,
Sep 28, 2022 Sep 28, 2022

Copy link to clipboard

Copied

LATEST

I just wanted to thank you for your assistance. It worked perfectly.

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