I need to validate a TextBox field, so when it is empty I paint the embroider indicating that it has some error with the field, I am using customValidator but it is not working.
The function code.
function ValidatxtECFNrSerie(src, args) {
if (args.Value.length > 1) {
args.IsValid = true;
}
else {
args.IsValid = false;
}
}
and field code to validate.
<asp:TextBox ID="txtECFNrSerie" runat="server" MaxLength="15" Width="150px"></asp:TextBox>
<asp:CustomValidator runat="server" ID="CustomValidator1" ClientValidationFunction="ValidatxtECFNrSerie" ErrorMessage=" * " ValidationGroup="vgValidarCampo" Display="Dynamic" ControlToValidate="txtECFNrSerie"></asp:CustomValidator>
How do I validate an empty field with CustomValidator?