G
Gary Larimer
Created a Custom Validation Ctrl in EW2 to validate a text box entry. Want
to make sure entry is evenly divisible by 7, and that value is not 0.
However, args.IsValid = false, even if 77 is entered in text box. Tag and
script that were added to page follow:
<asp:CustomValidator id="CustomValidator1" runat="server"
ClientValidationFunction="ClientValidateSerial3"
ControlToValidate="SerialNumber3" Display="Dynamic" ErrorMessage="Entry
Invalid"></asp:CustomValidator>
<script type="text/javascript">
function ClientValidateSerial3(source, args) {
if(args.value == 0) {
args.IsValid = false;
return;
}
if(args.value % 7 == 0) {
args.IsValid = true;
}
else {
args.IsValid = false;
}
}
</script>
This is my first attemp at using a Custom Validator and using javascript.
Serverside code for validation was not present when I tested the above
script in EW2.
Also posted question on EW discussion group.
Thanks for any tips/information.
to make sure entry is evenly divisible by 7, and that value is not 0.
However, args.IsValid = false, even if 77 is entered in text box. Tag and
script that were added to page follow:
<asp:CustomValidator id="CustomValidator1" runat="server"
ClientValidationFunction="ClientValidateSerial3"
ControlToValidate="SerialNumber3" Display="Dynamic" ErrorMessage="Entry
Invalid"></asp:CustomValidator>
<script type="text/javascript">
function ClientValidateSerial3(source, args) {
if(args.value == 0) {
args.IsValid = false;
return;
}
if(args.value % 7 == 0) {
args.IsValid = true;
}
else {
args.IsValid = false;
}
}
</script>
This is my first attemp at using a Custom Validator and using javascript.
Serverside code for validation was not present when I tested the above
script in EW2.
Also posted question on EW discussion group.
Thanks for any tips/information.