Re: RequiredFieldValidator doesn't work in non-IE browsers

From: Peter Blum (PLBlum_at_Blum.info)
Date: 11/10/04


Date: Tue, 9 Nov 2004 20:42:55 -0500

The lack of client-side validation support outside of IE is one of many
limitations in the ASP.NET validators. That's why I built a replacement to
the whole system.
Professional Validation And More (http://www.peterblum.com/vam/home.aspx)
supports client-side validation on IE, IE/Mac, Netscape7, Mozilla, FireFox,
Opera 7, and Safari. It includes 22 validators and numerous techniques that
greatly reduce the code you write for validation.

I put together a list of the ASP.NET validator limitations I've found at
http://www.peterblum.com/vam/home.aspx so users can better plan their
project.

--- Peter Blum
www.PeterBlum.com
Email: PLBlum@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Joe" <Joe@discussions.microsoft.com> wrote in message
news:F6D27455-64AA-419F-ABEC-AF77659783D6@microsoft.com...
> Hello,
>
> I have created a login page using dotnet. I am using
> requiredFieldValidator
> and noticed that the code works fine in IE but not in Netscape, Opera,
> Mozilla, Firefox, etc.
>
> For example if I do not enter anything in the form in IE, then form won't
> be
> submitted but in other browsers it is submitted.
>
> I checked that JavaScript is enabled in Netscape, Opera, Mozilla, Firefox,
> etc. and still the form doesn't work in these browsers.
>
> Is there any way I can make this code work in other browsers? I am using
> VB.NET for coding and not C#, so please suggest a solution in VB.NET.
>
> Thanks in advance for you help,
>
> Joe
>
> Here is my code,
>
> <table width="100%" border="0" cellpadding="2" cellspacing="2">
> <tr valign="top">
> <td height="40" colspan="3"
> class="subsubTitle"><font color="#993333"> All fields are
> required.</font></td>
> </tr>
> <tr>
> <td width="10%" class="hometext"><b>User
> ID</b></td>
> <td width="1%" class="hometext">:</td>
> <td width="89%" class="grey">
> <asp:TextBox ID="txtUserID" columns="25" runat="server" />
> <asp:RequiredFieldValidator
> id="RequiredFieldValidatorUID" runat="server"
> ErrorMessage="Please enter User ID." Display="None"
> ControlToValidate="txtUserID" />
> <asp:CompareValidator id="valRequiredUID" runat="server"
> ControlToValidate="txtUserID"
> ValueToCompare="007"
> Type="String"
> Operator="Equal"
> ErrorMessage="Please enter correct UserID."
> Display="dynamic">
> </asp:CompareValidator>
> </td>
> </tr>
> <tr>
> <td class="hometext"><b>Password</b></td>
> <td class="hometext">:</td>
> <td class="grey"><asp:TextBox ID="txtPwd"
> Columns="25" runat="server" />
>
> <asp:RequiredFieldValidator
> id="RequiredFieldValidatorPwd" runat="server"
> ErrorMessage="Please enter correct password." Display="None"
> ControlToValidate="txtPwd" />
> <asp:CompareValidator id="valRequiredPwd" runat="server"
> ControlToValidate="txtPwd"
> ValueToCompare="007"
> Type="String"
> Operator="Equal"
> ErrorMessage="Please enter correct password." Display="dynamic">
> </asp:CompareValidator>
> <asp:ValidationSummary id="ValidationSummary1"
> ShowMessageBox="True" ShowSummary="False" runat="server"/>
> </td>
> </tr>
> <tr>
> <td class="hometext"><b>Name</b></td>
> <td class="hometext">:</td>
> <td class="grey"><asp:TextBox
> id="txtName"
> columns="25" runat="server" />
> <asp:RequiredFieldValidator
> ID="RequiredFieldValidatorName" runat="server"
> ErrorMessage="Please enter your name." Display="None"
> ControlToValidate="txtName" />
> </td>
> </tr>
> <tr>
> <td class="hometext"><b>Company</b></td>
> <td class="hometext">:</td>
> <td class="grey"><asp:TextBox
> id="txtCompany" columns="25" runat="server" />
> <asp:RequiredFieldValidator
> id="RequiredFieldValidatorCompany" runat="server"
> ErrorMessage="Please enter your Company name." Display="None"
> ControlToValidate="txtCompany" />
> </td>
> </tr>
> <tr>
> <td class="hometext"><b>Email</b></td>
> <td class="hometext">:</td>
> <td class="grey"><asp:TextBox
> id="txtEmail" columns="25" runat="server" />
> <asp:RequiredFieldValidator
> id="RequiredFieldValidatorEmail" runat="server"
> ErrorMessage="Please enter your Email address." Display="None"
> ControlToValidate="txtEmail" />
>
> <asp:RegularExpressionValidator id="valValidEmail" runat="server"
> ControlToValidate="txtEmail"
>
> ValidationExpression="^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
> ErrorMessage="Invalid Email address."
> Display="None">
> </asp:RegularExpressionValidator>
> </td>
> </tr>
> <tr>
> <td colspan="3" height="1"><img
> src="../images/spacer.gif" width="2" height="1"></td>
> </tr>
> <tr>
> <td colspan="3" class="grey"></td>
> </tr>
> <tr>
> <td colspan="3" height="1"><img
> src="../images/spacer.gif" width="2" height="1"></td>
> </tr>
> <tr>
> <td class="grey" colspan="3"><div
> align="left">
> <table width="100%" border="0"
> cellspacing="0" cellpadding="2">
> <tr>
> <td width="12%"
> class="hometext"><asp:Button id="btnSubmit" OnClick="submit" Text="Login"
> runat="server" /></td>
> <td width="88%"
> class="hometext"> </td>
> </tr>
> </table>
> </div></td>
> </tr>
> </table>
>


Loading