Validators not working on Mozilla

T

tshad

I have a RegularExpressionValidator that is testing a field to make sure the
number is between 0 and 255. It works fine in IE, but doesn't work in
Mozilla or Firefox.

<asp:RegularExpressionValidator ID="Years"
ControlToValidate="YearsComplete" Display="Dynamic"
ErrorMessage="<br>Not a valid number"
ValidationExpression="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
Runat="server"/>

Why doesn't it work?

Does this mean none of my Validators are working for these Browsers?

Thanks,

Tom
 
T

Teemu Keiski

Using ASP.NET 1 or 2? Note that despite having validators control on the
page, you need to check Page.IsValid always before any critical code runs,
to do server-side validation check (in case you run custom code within
button's click etc)
 
T

tshad

Teemu Keiski said:
Using ASP.NET 1 or 2? Note that despite having validators control on the
page, you need to check Page.IsValid always before any critical code runs,
to do server-side validation check (in case you run custom code within
button's click etc)

I am using ASP.Net 1.1.

The problem is that it is working fine in IE. As I tab out of the field,
the error is caught and message displayed. But not in the other browsers.

Thanks,

Tom
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


tshad said:
I have a RegularExpressionValidator that is testing a field to make sure
the number is between 0 and 255. It works fine in IE, but doesn't work in
Mozilla or Firefox.

<asp:RegularExpressionValidator ID="Years"
ControlToValidate="YearsComplete" Display="Dynamic"
ErrorMessage="<br>Not a valid number"
ValidationExpression="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
Runat="server"/>

Why doesn't it work?

Does this mean none of my Validators are working for these Browsers?

Thanks,

Tom
 
M

Martin Honnen

tshad wrote:

I am using ASP.Net 1.1.

The problem is that it is working fine in IE. As I tab out of the field,
the error is caught and message displayed. But not in the other browsers.

If validation happens when you tab out of the field then I am pretty
sure that validation is done with client-side script ASP.NET has
generated. And ASP.NET 1.1 usually generates client-side script geared
towards IE 4 and later using the IE DOM and not the more cross browser
compatible W3C DOM, therefore with the normal settings browsers like
Mozilla will not get that client-side script at all. Server-side
validation on postback should nevertheless work independent of the
browser and any client-side script ASP.NET might or might not generate.
 
T

tshad

Martin Honnen said:
tshad wrote:



If validation happens when you tab out of the field then I am pretty sure
that validation is done with client-side script ASP.NET has generated. And
ASP.NET 1.1 usually generates client-side script geared towards IE 4 and
later using the IE DOM and not the more cross browser compatible W3C DOM,
therefore with the normal settings browsers like Mozilla will not get that
client-side script at all. Server-side validation on postback should
nevertheless work independent of the browser and any client-side script
ASP.NET might or might not generate.

That was what I figured and as soon as I added the test for IsValid, it
seems to work fine.

Thanks,

Tom
 

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,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top