I have a piece of JavaScript code that keeps throwing an 'Is Undefined' error.
< script language = "javascript"
type = "text/javascript" >
// fuction added for click on submit - dp0jmr 05/23/2018
function checkScheduleAndAmount() {
var ppAmt = (double)
<%=p.getPaymentPlanAmt()%>;
var totalamt = (double) document.getElementById("sum").innerText;
if (ppAmt != totalamt) {
alert("The Payment Plan Schedule does not add up to the total Payment Plan Amount - this Payment Plan cannot be submitted." +
" Please correct the Amounts entered and submit the Payment Plan Schedule before leaving this page." +
"\n\nIf the Date Range you have entered does not allow you to enter the Plan you desire, please End this Payment Plan " +
"and begin a new one." +
"\n\nIf you know the installment amount you wish to use, you can enter an installment amount at the start of a new " +
"Payment Plan, and the application will calculate the final payoff date for you. ");
return false;
} else {
return true;
}
}
<
/script>
I've eliminated as many possible culprits as I could:
- I've tried every combination of script definitions - there is some JQuery in addition to this JavaScript, but it was running fine alongside it until recently.
- I tried putting it inside the page element with no effect.
- I don't see any obvious syntax errors - all the variables being used here are defined.
The function call is on an html:button tag, at the very bottom of the div.
<html:submit property="submitValue" value="<%=PaymentPlanDetailsForm.SUBMIT%>" styleClass="button" disabled="<%=isActive %>" onclick="return checkScheduleAndAmount()" onkeypress="return false"/>
This started to occur recently after refining my JQuery function, but both functions seemed to be working fine during testing, and even seemed to work without issue together for awhile - and unfortunately, I cannot revert my changes now because I made the mistake of closing the IDE. :(
Am I missing something obvious in the syntax for this? Or is there another reason my page isn't recognizing my javascript function?

double?