Combine regular expression validator with javascript function?

D

Dot net work

Hello.

Say I have a .net textbox that uses a .net regularexpressionvalidator.
If the regular expression fails, is it possible to launch a small
client side javascript function to do something, such as change the
border color of the textbox to red? That would look quite nice: if
the expression fails, the red validator text is shown, plus the
textbox's border goes red.

TIA,
-dnw.
 
D

Dot net work

I was not able to somehow combine the regular expression validator
control with a client side javascript function, so instead I took the
regular expression that I needed and put it inside a custom validator
client side function, then added on some extra javascript that changed
the textbox border to red.

-dnw.
 
P

Peter Blum

There is a solution that avoids rewriting every validator. It requires using
a replacement to Microsoft's validators that is designed to handle this kind
of communication. Microsoft's validators are limited to showing an error
message in the location of the validator. There are other ways to
communicate to the user: setting focus to the field, changing the field,
label or background color, blinking the error message and putting up an
alert. "Professional Validation And More"
(http://www.peterblum.com/vam/home.aspx) has all of these capabilities
supporting its 22 validators. Its designed to avoid writing custom code and
hacks due to the many limitations of Microsoft's validators.

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

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top