By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 2,858 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

Validators and client side script

P: n/a
Hi

I have some regex validators on my page set to dynamic and like the way they
appear after you tab out of a field and also when you try to postback the
form.
All OK so far

When I register for the client side event of a textbox using ...

textBox.Attributes.Add("onKeyUp","javascriptfuncti on");

eg onKeyUp or onKeyDown the above validators stop working for the case when
you leave the text box (postback still works).
I was thinking it is probably because I have overidden the event the
validators use. I had a good look at the source of the page but couldnt see
the client side events for the validators.

Is am thinking there must be a way to have the validators working for
controls with their own clientside events otherwise no one could write a
control which works with the ASP.NET validators.

Many Thanks

Mike
Jan 27 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> Hi

I have some regex validators on my page set to dynamic and like the way they
appear after you tab out of a field and also when you try to postback the
form.
All OK so far

When I register for the client side event of a textbox using ...

textBox.Attributes.Add("onKeyUp","javascriptfuncti on");

eg onKeyUp or onKeyDown the above validators stop working for the case when
you leave the text box (postback still works).
I was thinking it is probably because I have overidden the event the
validators use. I had a good look at the source of the page but couldnt see
the client side events for the validators.

Is am thinking there must be a way to have the validators working for
controls with their own clientside events otherwise no one could write a
control which works with the ASP.NET validators.

Many Thanks

Mike


Try and add a ";" after your "javascriptfunction", as a separator
between your statement and the .net autogenerated one.
(at least for linkbuttons, this works)

Hans Kesting
Jan 27 '06 #2

P: n/a
Cheers Stan

For anyone else I found that this out

Writing a javascript function that hooks onKeyDown I change the value of
the textbox.
This has the effect of breaking the lost focus validation.
You can cause the validator to fire by calling
ValidatorOnChange(event);

in your javascript.

Mike

"Spam Catcher" <sp**********@rogers.com> wrote in message
news:Xn**********************************@127.0.0. 1...
"Mike Surcouf" <mike@$surcouf.co(.uk> wrote in news:#NPkKtyIGHA.216
@TK2MSFTNGP15.phx.gbl:
Is am thinking there must be a way to have the validators working for
controls with their own clientside events otherwise no one could write a
control which works with the ASP.NET validators.


Take a look at this article:

http://msdn.microsoft.com/library/de...l=/library/en-
us/dnaspp/html/aspplusvalid.asp

Take a look at the Client-API side - it shows you how to fire particular
validators.

--
Stan Kee (sp**********@rogers.com)

Boycott StarForce!
http://www.glop.org/starforce

Jan 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.