zimmer9
asked on
Do you know why I get the error "JavaScript runtime error: 'AmountValidation' is undefined in my .aspx source code ?
I am developing an ASP.Net application using .Net Framework 4.6 and VS2015.
I have an aspx file with the following JavaScript code:
Do you know why I get the following JavaScript runtime error:
0x800a1391 - JavaScript runtime error: 'AmountValidation' is undefined?
</table>
<script type="text/javascript">
function Allvalidate() {
var ValidationSummary = "";
ValidationSummary += AccountValidation();
ValidationSummary += AmountValidation();
if (ValidationSummary != "") {
alert(ValidationSummary);
return false;
}
else {
alert("Information submited successfuly");
return true;
}
}
function AccountValidation() {
var userid;
var controlId = document.getElementById('< %= txtAccntnum.ClientID %>');
userid = controlId.value;
var val = /^[0-9-]+$/;
if (userid == "") {
return ("Please Enter Correct Account Number" + "\n");
}
else if (val.test(userid)) {
return "";
}
else {
return ("Account Numb should be in this form example: [0-9] and Hyphens " + "\n");
}
function AmountValidation() {
var amountid;
var textId = document.getElementById('< %= txtAmount.ClientID %>');
amountid = textId.value;
var val1 = /^-?[0-9]+(.[0-9]{1,2})/;
if (textId == "") {
return ("Please Enter Correct Dollar Amount" + "\n");
}
else if (val1.test(amountid)) {
return "";
}
else {
return ("Dollar Amount should be in this form example: [0-9] and Decimal " + "\n");
}
}
}
</script>
</asp:Content>
I have an aspx file with the following JavaScript code:
Do you know why I get the following JavaScript runtime error:
0x800a1391 - JavaScript runtime error: 'AmountValidation' is undefined?
</table>
<script type="text/javascript">
function Allvalidate() {
var ValidationSummary = "";
ValidationSummary += AccountValidation();
ValidationSummary += AmountValidation();
if (ValidationSummary != "") {
alert(ValidationSummary);
return false;
}
else {
alert("Information submited successfuly");
return true;
}
}
function AccountValidation() {
var userid;
var controlId = document.getElementById('<
userid = controlId.value;
var val = /^[0-9-]+$/;
if (userid == "") {
return ("Please Enter Correct Account Number" + "\n");
}
else if (val.test(userid)) {
return "";
}
else {
return ("Account Numb should be in this form example: [0-9] and Hyphens " + "\n");
}
function AmountValidation() {
var amountid;
var textId = document.getElementById('<
amountid = textId.value;
var val1 = /^-?[0-9]+(.[0-9]{1,2})/;
if (textId == "") {
return ("Please Enter Correct Dollar Amount" + "\n");
}
else if (val1.test(amountid)) {
return "";
}
else {
return ("Dollar Amount should be in this form example: [0-9] and Decimal " + "\n");
}
}
}
</script>
</asp:Content>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.