Calculation Script


i have field percentage needs calculated. ideally, when user enters value, entered number divided 30 , multiplied 20. code i've put custom calculation script:

 

event.value = (event.value/30)*20;

event.value = util.printf("%.2f", event.value).replace(/\.?[0]+$/, "");

 

is there way to:

- set upper limit on value can entered user? (max of 30)

- append percentage sign (%) calculated value? (the calculated value percent)

- leave field blank instead of 0 if user has not entered value?

 

also, problem have script value being repeatedly calculated. have multiple fields need calculated way, same script in each of fields. when value entered first field, calculated correctly. upon entering value next field however, calculated value of first field has been recalculated. ideas why happening , how can fixed?

 

my sincere help.

let's start last issue, that's serious one. there basic problem way you're doing it. calculation script of field executes each time field edited. means when you're editing field2, value of field1 (re-)calculated. because of way wrote code, means each time happens you're multiplying value 2/3... it's not approach edit value entered user (or current value) directly in field. better apporach have 1 field data entry, , field show calculated value (the second field can read-only, user can't edit directly).

then not encounter issue result of each calculation same.



More discussions in JavaScript


adobe

Comments

Popular posts from this blog

Adobe Acrobat Pro , Terminal Server Use

Thread: transmission-daemon isn't playing nice: "409: Conflict"

Thread: gpg: Conflicting Commands