Calcuation script - "the value entered does not match the format of the field.
I have the following fields in my document:
Total Revenue - this is manually entered field
Gross Profit - this has a calulation in it
Actual Gross Profit %
Originally I had the calculation in Acutal Gross Profit % as Gross Profit/Total Revenue and I was getting message "the value entered does not match the format of the field". From searching around online I know that this happens when Total Revenue field is blank and a formula can't be used when divisible by zero. I've tried different scripts suggested but I'm having a hard time having it work with my specific scenario. Can anyone help? Java script is way beyond my knowlege base so if someone can provide a script for me that I cna use that would be helpful.
I was able to get rid of the message with the following code, but now calculation doesn't work.
var numerator = +getField("Gross_Profit").value;
var denominator = +getField("Total_Revenue").value;
if (denominator !== 0) {
event.value = numerator / denominator;
} else {
event.value = "";
}