I am facing an issue with client-side validation using JavaScript (.js). Despite linking the path in the head section, the ASP file doesn't seem to reach the JavaScript file.
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Acceuil</title>
<link href="styles.css" rel="stylesheet" />
<script src="js/validation.js" type='text/javascript'></script>
</head>
Validator:
<asp:CustomValidator runat="server"
ID="CustomValidatorJava"
ClientValidationFunction="ClientValidateMatricule"
ErrorMessage="Le format du matricule est incorrect"
ControlToValidate="txtBoxMatricule"
ValidateEmptyText="True"
EnableClientScript="True" BackColor="Black" ForeColor="White">
</asp:CustomValidator>
JavaScript File Content:
function ClientValidateMatricule(source, arguments)
{
if (arguments.Value.length == 7) {
var cpt = 0;
for (var i = 0; i < arguments.Value.length; i++) {
if (isNaN(arguments[i])) {
arguments.isValid = false;
break;
} else if ((!isNaN(arguments[i]))) {
cpt++;
}
}
if (cpt == arguments.Value.length) {
arguments.isValid = true;
}
} else {
arguments.isValid = false;
}
}
Moreover, when I place a breakpoint in the JavaScript file and debug is running, a yellow triangle appears indicating that it won't be reached because no symbol has been loaded.