Value entered doesn't match the format
Good Afternoon,
First of all, when I've posted questions on coding JAVASCRIPT people have been amazing as I learn (I'm a novice). I appreciate any and all feedback. I have a form that I've been working on and so close to being finished with it. I keep getting an error "the value entered doesn't match the format of the field". I've tried but cannot not figure out how to resolve this issue. The scenario involves a % issue. I have 3 separate lines that have a % as a result for answer. The results are considered: Step 1 ("F7"), Step 2 ("F10") and Step 3 ("F13"). If Step 1 has a result that a percentage will appear. If step 1 is not used then the answer will appear as 0%. Same goes for Step 2 and Step 3. Step 4 ("F14") and this is Step 1 + Step 2 + Step 3. So, if the result was 1000% then the result would be 3000%. Step 5 ("F15") is Step 4 / the number of steps is used. So, if Step 1 is the only the divisor is 1, If Step 1 and Step 2 are used then the divisor is 2. and If Step 1, Step 2 and Step 3 are used then the divisor is 3. If no steps are used then the divisor is 0. The other issue is if the percentage is greater than 100% then the result is 100%. If if is less than 100% then the result is the average or 0. Here is the code I've written so far which gives me a result but errors out as with the value entered doesn't match the format of the field. F1000 will give a value of 1 if step 1 is used, F1001 will give a value of 1 if step 2 is used and F1002 will give a value of 1 if Step 3 is used. F14 is the percentage values added up for Step 1, Step 2 and Step 3.
var theField = this.getField("F1000");
var theValue = theField.value;
var theField2 = this.getField("F1001");
var theValue2 = theField2.value;
var theField3 = this.getField("F1002");
var theValue3 = theField3.value;
var theField4 = this.getField("F14");
var theValue4 = theField4.value;
if (theValue+theValue2+theValue3 < .000001) {
this.getField("F15").value= theValue4 / (theValue + theValue2 + theValue3);
}
else {
this.getField("F15").value=1;
}
Any help would be greatly appreciated!
Sincerely,
Steve
