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

Custom validator control does not always fire

P: n/a
Hello.

If I use an asp.net custom validator control to validate a textbox,
what I find is that if I enter in some text that I have already
entered and validated in a previous session (you know when you start
typing inside a textbox, you see things that have already been typed
before), then when I click off the textbox, the custom validator
client side jscript does not run. I really need the custom jscript
validator code to run everytime, regardless of whether the text in
question has been successfully validated before in a previous session.

Thanks if anyone knows the answer!

-dnw.
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Validators only fire when the browser invokes the onchange event associated
with the field.

Unfortunately, onchange does not fire in some cases:
- If you edit the field but edit it back to the original.
- If you pick from the AutoComplete dropdown (which I think you are talking
about). Its annoying and personally, I think its a design flaw in IE.

Microsoft has provided a good defense for this: the server side always
validates. You should NEVER assume the client-side validates. Only IE and
IE/Mac browsers support the client-side validation code because its written
in DHTML. The user can disable javascript on those same browsers. So you
must be sure that Page.Validate() is called (it happens automatically on
buttons whose CausesValidation property is true) and you test for
Page.IsValid prior to saving.

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

"Dot net work" <do***@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
Hello.

If I use an asp.net custom validator control to validate a textbox,
what I find is that if I enter in some text that I have already
entered and validated in a previous session (you know when you start
typing inside a textbox, you see things that have already been typed
before), then when I click off the textbox, the custom validator
client side jscript does not run. I really need the custom jscript
validator code to run everytime, regardless of whether the text in
question has been successfully validated before in a previous session.

Thanks if anyone knows the answer!

-dnw.

Nov 18 '05 #2

P: n/a
Thanks very much for the info.

"Peter Blum" <PL****@Blum.info> wrote in message news:<uo*************@TK2MSFTNGP12.phx.gbl>...
Validators only fire when the browser invokes the onchange event associated
with the field.

Unfortunately, onchange does not fire in some cases:
- If you edit the field but edit it back to the original.
- If you pick from the AutoComplete dropdown (which I think you are talking
about). Its annoying and personally, I think its a design flaw in IE.

Microsoft has provided a good defense for this: the server side always
validates. You should NEVER assume the client-side validates. Only IE and
IE/Mac browsers support the client-side validation code because its written
in DHTML. The user can disable javascript on those same browsers. So you
must be sure that Page.Validate() is called (it happens automatically on
buttons whose CausesValidation property is true) and you test for
Page.IsValid prior to saving.

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

"Dot net work" <do***@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
Hello.

If I use an asp.net custom validator control to validate a textbox,
what I find is that if I enter in some text that I have already
entered and validated in a previous session (you know when you start
typing inside a textbox, you see things that have already been typed
before), then when I click off the textbox, the custom validator
client side jscript does not run. I really need the custom jscript
validator code to run everytime, regardless of whether the text in
question has been successfully validated before in a previous session.

Thanks if anyone knows the answer!

-dnw.

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.