I'm able to complete the PDF form. But I feel that I can simplied this part as well.
On one field I am calculating a percentage. I call this field PercentTermEnroll. This is calculated based on the number a student is enrolled divided by the total number of days in a term. This is working just fine.
But I have the user entering a dollar amount in field T_DSL (Total Award Received). In another field called R_DSL (Revised Total Award) I am basically doing a multiplication of two fields:
T_DSL*PercentTermEnroll
So if I enter $1,000 under field T_DSL and the percent is 9.6%, the revised total award (R_DSL) is $96
R_DSL = T_DSL*PercentTermEnroll
R_DSL = 1000*9.6% = 1000*0.096 = 96
But what I want to do is that if the percent is greater than 60.1%, the Revised Total Award (R_DSL) must be zero.
I basically put on the PDF form a note, that if the percent was greater than 60.1% to stop and not complete the form. But we may have students who don't read the form in its entirely and they will fill out the form. So instead of giving them a wrong value, I would like a script that would put a zero if the percent was greater than 60.1%.
Thank you! .
// Custom Calculate script
(function () {
// Get the field values, as numbers
var v1 = +getField("T_DSL").value;
var v2 = +getField("Percent_Term_Enroll").value;
// Set this field value
event.value = (v2 > 0.601) ? 0 : v1 * v2;})();