C
COHENMARVIN
I have a customValidator that calls a client function.
Here is the client function
<script language="JavaScript">
function ClientValidate(objSource, objArgs)
{
var intnumber = objArgs.Value;
if (intnumber > 5)
{
objArgs.IsValid = False;
return False;
}
Else
{
objArgs.IsValid = True;
return True;
}
}
</script>
Here is the CustomValidator:
<ASP:CustomValidator id="valCustom" runat="server"
ControlToValidate = "MyTextBox"
ClientValidationFunction="ClientValidate"
ErrorMessage="* Value must be less than or equal to 5 "
Display="Dynamic">
*
</asp:CustomValidator>
The problem is that the custom validator puts a red asterix next to the
textbox field even when the number entered into the textbox is valid.
It treats all numbers as wrong. Another problem involves the
ValidationSummary control (see below)
<ASP:ValidationSummary id="valSummary" runat="server"
ShowSummary="True"
ShowMessageBox = "True" DisplayMode="List" HeaderText = "<b>The
following errors were found</b>" />
This should give an error message when the value in "MyTextBox" is
wrong, but it doesn't.
-- CohenMarvin
Here is the client function
<script language="JavaScript">
function ClientValidate(objSource, objArgs)
{
var intnumber = objArgs.Value;
if (intnumber > 5)
{
objArgs.IsValid = False;
return False;
}
Else
{
objArgs.IsValid = True;
return True;
}
}
</script>
Here is the CustomValidator:
<ASP:CustomValidator id="valCustom" runat="server"
ControlToValidate = "MyTextBox"
ClientValidationFunction="ClientValidate"
ErrorMessage="* Value must be less than or equal to 5 "
Display="Dynamic">
*
</asp:CustomValidator>
The problem is that the custom validator puts a red asterix next to the
textbox field even when the number entered into the textbox is valid.
It treats all numbers as wrong. Another problem involves the
ValidationSummary control (see below)
<ASP:ValidationSummary id="valSummary" runat="server"
ShowSummary="True"
ShowMessageBox = "True" DisplayMode="List" HeaderText = "<b>The
following errors were found</b>" />
This should give an error message when the value in "MyTextBox" is
wrong, but it doesn't.
-- CohenMarvin