Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Custom validator control does not always fire

Reply
Thread Tools

Custom validator control does not always fire

 
 
Dot net work
Guest
Posts: n/a
 
      05-11-2004
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.
 
Reply With Quote
 
 
 
 
Peter Blum
Guest
Posts: n/a
 
      05-11-2004
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: http://www.velocityreviews.com/forums/(E-Mail Removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Dot net work" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.



 
Reply With Quote
 
 
 
 
Dot net work
Guest
Posts: n/a
 
      05-12-2004
Thanks very much for the info.

"Peter Blum" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> 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: (E-Mail Removed)
> Creator of "Professional Validation And More" at
> http://www.peterblum.com/vam/home.aspx
>
> "Dot net work" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP: Custom Validator won't fire Ben ASP .Net 1 07-28-2005 08:49 PM
Fire Custom Validator on AutoPostback tshad ASP .Net 4 03-01-2005 10:33 PM
How to get custom control to work with custom validator Scott Yenor ASP .Net Web Controls 0 01-27-2004 12:37 AM
TextChange event does not always fire Duwayne ASP .Net 1 08-20-2003 09:18 PM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM



Advertisments