empty field blows up calculations
in completion field have entered simple formula percentage display. formula (cumulativeamount1/budget1)*100 way. math works correctly problem i'm having when first 3 fields in row left empty blows , gives me "value entered not match format of [field]" error. i'm looking fix that. i'd fields remain empty unless value entered of first 3 fields in row.
i have 0 skills @ this. know basics of excel formulas please forgive ignorance.
any appreciated.
ok, so, let's first dig math skills: happens when divide value zero? yep, result + or - infinity (not beyond here…). happens when divide 0 zero? yep, result undefined.
with that, have cause of problem; division zero. when program such formula?
that means working bit on acrobat forms , javascript skills…
let's assume table set name of each field in row ends row number. let's assume have 8 rows in table. finally, let's assume percentage field formatted percentage.
it considered best practice consolidate scripts 1 single script, , add calculate event of hidden, readonly field, otherwise not involved in way rest of form.
the segment of script percentage calculation may this:
for (var = 1 ; <= 8 ; i++) {
if (this.getfield("cumulativeamount" + i).value != this.getfield("cumulativeamount" + i).defaultvalue && this.getfield("budget" +i).value != this.getfield("budget" + i).defaultvalue) {
this.getfield("percentage" + i).value = this.getfield("cumulativeamount" + i).value*1 / this.getfield("budget" + i).value*1 ;
}
}
and should (note script has 5 lines in total; 1 or 2 lines may break).
hope can help.
More discussions in PDF Forms
adobe
Comments
Post a Comment