Skip to main content
Participant
August 24, 2022
Question

Custom Form Field Calculations - a numeric field plus a defined number

  • August 24, 2022
  • 1 reply
  • 415 views

Hi,

 

I am trying write a custom calcuation script in a PDF form.

 

I wanted to calculate the value of field C, and I wanted the value of field C to equal the value of field A + .05. However, if this value of field C (which is the value of field A + .05) is over .1795, I want feild C to show .1795.

 

How would I write this on a PDF form?  

 

 

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
August 24, 2022

Use this as custom calculation script of field "C":

var a = this.getField("A");
if(a.value){
var n = Number(a.value)*0.5;
if(n > .1795)event.value = .1795;
else
event.value = n;}
else
event.value = "";

JYamAuthor
Participant
August 24, 2022

Thank you Nesa, I ended up replacing the "*" between "Number(a.value)" and "0.5" with a "+" it would add to value A, but it worked!

Nesa Nurani
Community Expert
Community Expert
August 24, 2022

Sorry about that,  my mistake.