I am getting an error message with the script I'm using to divide 2 fields to equal a percent. Everything actually works correctly, it's just when I reset the field I get "The value entered does not match format of the field." For example, I have a script in "text3" field that says:
v1 = this.getField("text1").value;
v2 = this.getField("text2").value;
event.value = v1 / v2;
But I have the format of this field as a Percentage because that's the only way I can get it to display correctly, I think this is causing the error though. Once I start putting numbers in "text1" and "text2" it divides and displays the correct amount, it only gives the error when text3 field is blank or when I reset all fields. Instead of using Adobe's format to select Percentage, can I somehow put in the script I already have to make this field a percent?
Thank you in advance for your help!
Division by 0 is not allowed. You have to check v2 is not zero before
applying the calculation.
Thank you!! I made an adjustment to the script to only divide if field is greater than 0 and that worked perfect