1 Reply Latest reply on Mar 10, 2016 4:20 PM by George_Johnson

# create field calculation with option input allowed

I am new to this so any help would be appreciated.

I am creating a contract and as part of the contract I have a total which is broken up into 3 payments.  I would like to have the ability to let the user enter in a value as well as have the form calculate it.

fields = total, pay1, pay2, and pay3

total is populated by the user.

pay1,pay2 and pay3 have a custom script which breaks it into 3 equal payments.

if (this.getField("total").valueAsString=="") event.value = "";

else event.value = ( this.getField("total").value / 3 );

I would like to have the option on pay1 and pay2 of overstriking the amount, then breaking out the remaing value to the remaining fields (pay2 and/or pay3)

As it is now:  total = 999 pay1, pay2, and pay3 would equal 333

I would like to have total =999

user types 400 in pay1, then pay2 should =299.50 and pay3=299.500

or

user types 400 into pay1, then pay2 should =250 and pay3=250 user then overstrikes pay2 with 200, then pay3 would equal 399.00.

windows 10

• ###### 1. Re: create field calculation with option input allowed

This could get complicated, especially when trying to use calculation script. What should happen in this scenario:

total = 999, so pay, pay2, and pay3 get automatically set to 333.00. But user then changes pay3 to 400? And then changes pay1 to 400? And then changes pay2 to 400?

Also, you have to take care to round correctly so that for a total of 1000, the three values are initially set to 333.33, 333.33, and 333.34, though it's not clear to me which field should be the one to get set to 333.34.