J
James
Hello,
I have a RequiredFieldValidator for several textbox controls on a
form. Here's an example with the RequiredFieldValidator.
EnableClientScript, Enabled, and Visible are set to true for the
RequiredFieldValidator.
<asp:textbox id="FirstName" MaxLength="25"
runat="server"></asp:textbox>
<asp:requiredfieldvalidator id="RequiredFieldValidator1"
runat="server" ControlToValidate="FirstName" ErrorMessage="First Name
is Required"></asp:requiredfieldvalidator>
If I browse to the form and immediately click the submit button,
Page.IsValid returns true and I get no ErrorMessage displays. Is this
by design?
Also, if I tab through each text box all the way to the submit button,
the form functions the same way. Is the textbox control not
considered "having focus" when it's tabbed to?
The only way I get the ErrorMessage displays is to enter something
into the controls, tab off, go back to the control, remove what I
entered, then tab off again. At this point I receive the ErrorMessage
displays.
Is this the only way the RequiredFieldValidator works or could I have
some settings wrong?
Thanks,
-Cliff
I have a RequiredFieldValidator for several textbox controls on a
form. Here's an example with the RequiredFieldValidator.
EnableClientScript, Enabled, and Visible are set to true for the
RequiredFieldValidator.
<asp:textbox id="FirstName" MaxLength="25"
runat="server"></asp:textbox>
<asp:requiredfieldvalidator id="RequiredFieldValidator1"
runat="server" ControlToValidate="FirstName" ErrorMessage="First Name
is Required"></asp:requiredfieldvalidator>
If I browse to the form and immediately click the submit button,
Page.IsValid returns true and I get no ErrorMessage displays. Is this
by design?
Also, if I tab through each text box all the way to the submit button,
the form functions the same way. Is the textbox control not
considered "having focus" when it's tabbed to?
The only way I get the ErrorMessage displays is to enter something
into the controls, tab off, go back to the control, remove what I
entered, then tab off again. At this point I receive the ErrorMessage
displays.
Is this the only way the RequiredFieldValidator works or could I have
some settings wrong?
Thanks,
-Cliff