Question about Validation Controls

G

Guest

Hi,

I have a form with three text fields and a Submit button. The two text
fields have ReqiredFieldValidator and third text field has
RegularExpressionValidator. The page validation works fine in Internet
Explorer but I noticed that in FireFox, Netscape and Mozilla, they don’t
work.

These validation controls are set to run servside then why they don’t work
in non-IE browser.

Is there any workaround?

Thanks,

Joe
 
L

Lucas Tam

These validation controls are set to run servside then why they donƒ
Tt work in non-IE browser.

Did you implement the server side event handler for the validation
controls?
 
G

Guest

MY form code as follows and it works fine in Internet Explorer but doesn't
work in non-IE browsers.

<form id="test" runat="server">
<table >
<tr>
<td><table>
<tr>
<td>*Required Field</td>
<td> </td>
</tr>
<tr>
<td>*First Name</td>
<td><asp:TextBox ID="FirstName" columns="25" runat="server" />
<asp:RequiredFieldValidator
id="RequiredFieldValidator1" runat="server"
ErrorMessage="Please enter your First name." Display="None"
ControlToValidate="FirstName" />
<asp:ValidationSummary id="ValidationSummary1"
ShowMessageBox="True" ShowSummary="False" runat="server"/>
</td>
</tr>
<tr>
<td>*Last Name</td>
<td><asp:TextBox id="LastName" columns="25" runat="server" />
<asp:RequiredFieldValidator
ID="RequiredFieldValidator2" runat="server"
ErrorMessage="Please enter your Last name." Display="None"
ControlToValidate="LastName" />
</td>
</tr>
<tr>
<td>*Email</td>
<td class="grey"><asp:TextBox id="txtEmail" columns="25"
runat="server" />
<asp:RequiredFieldValidator
ID="RequiredFieldValidator5" runat="server"
ErrorMessage="Please enter your Email address." Display="None"
ControlToValidate="Email" />
<asp:RegularExpressionValidator id="valValidEmail"
runat="server"
ControlToValidate="Email"

ValidationExpression="^([_a-zA-Z0-9-]+)(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+)(\.[a-zA-Z0-9-]+)*(\.[a-z]{2,4})$"
ErrorMessage="Invalid Email address."
Display="None">
</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td></td>
<td><br /><asp:Button id="Submit" OnClick="submit" Text="Submit"
runat="server" />
</td>

</tr>
</table></td>
</tr>
</table>
</form>
 
B

Bruce Barker

in the code behind in onload check Page.IsValid. referencing this property
run the serverside validation routines.

-- bruce (sqlwork.com)


Joe said:
MY form code as follows and it works fine in Internet Explorer but doesn't
work in non-IE browsers.

<form id="test" runat="server">
<table >
<tr>
<td><table>
<tr>
<td>*Required Field</td>
<td> </td>
</tr>
<tr>
<td>*First Name</td>
<td><asp:TextBox ID="FirstName" columns="25" runat="server" />
<asp:RequiredFieldValidator
id="RequiredFieldValidator1" runat="server"
ErrorMessage="Please enter your First name." Display="None"
ControlToValidate="FirstName" />
<asp:ValidationSummary id="ValidationSummary1"
ShowMessageBox="True" ShowSummary="False" runat="server"/>
</td>
</tr>
<tr>
<td>*Last Name</td>
<td><asp:TextBox id="LastName" columns="25" runat="server" />
<asp:RequiredFieldValidator
ID="RequiredFieldValidator2" runat="server"
ErrorMessage="Please enter your Last name." Display="None"
ControlToValidate="LastName" />
</td>
</tr>
<tr>
<td>*Email</td>
<td class="grey"><asp:TextBox id="txtEmail" columns="25"
runat="server" />
<asp:RequiredFieldValidator
ID="RequiredFieldValidator5" runat="server"
ErrorMessage="Please enter your Email address." Display="None"
ControlToValidate="Email" />
<asp:RegularExpressionValidator id="valValidEmail"
runat="server"
ControlToValidate="Email"

ValidationExpression="^([_a-zA-Z0-9-]+)(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+)(\.[a-zA-Z0-9-]+)*(\.[a-z]{2,4})$"
ErrorMessage="Invalid Email address."
Display="None">
</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td></td>
<td><br /><asp:Button id="Submit" OnClick="submit" Text="Submit"
runat="server" />
</td>

</tr>
</table></td>
</tr>
</table>
</form>






Lucas Tam said:
Did you implement the server side event handler for the validation
controls?


--
Lucas Tam ([email protected])
Please delete "REMOVE" from the e-mail address when replying.
Horrible experience at Newmarket Volvo:
http://newmarketvolvo.tripod.com
 
S

Scott M.

In VS.NET, you don't need to do anything to implement the server-side events
(unless you are using a Custom Validator).
 
L

Lucas Tam

In VS.NET, you don't need to do anything to implement the server-side
events (unless you are using a Custom Validator).

Just incase the guy was using a custom validator.

In anycase, to the OP - did you call Page.Validate?
 
P

Peter Blum

Hi Joe,

Let's get back to your original question. Yes, there is a way to get
client-side validation to work with non-IE browsers. ASP.NET 2.0 and my
Professional Validation And More (http://www.peterblum.com/vam/home.aspx)
are two solutions. For details on this issue and much more knowledge about
the Microsoft validators, see this article: www.aspalliance.com/699.

I also noticed that in your code, your ValidationSummary control has
ShowMessageBox=true and ShowSummary=false. The ShowMessageBox feature
requires client-side validation. On non-IE browsers, the ASP.NET 1.x
validators simply will not show anything for the ValidationSummary. So if
you want this to work, you will have to consider the alternatives (my
software, other third party controls, or ASP.NET 2.0).

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 
G

Guest

Thanks guys, I noticed that I wasn’t using Page.IsValid and then if the empty
form is submitted then I user can’t submit the form but because I am using
ShowMessageBox="True" ShowSummary="False" to display an alert pop-up window
in IE, how do I show a message to user in non-IE on postback?

Any clues and thanks for your great help.

joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top