Custom validator control does not always fire

Discussion in 'ASP .Net' started by Dot net work, May 11, 2004.

  1. Dot net work

    Dot net work Guest

    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.
    Dot net work, May 11, 2004
    #1
    1. Advertising

  2. Dot net work

    Peter Blum Guest

    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:
    Creator of "Professional Validation And More" at
    http://www.peterblum.com/vam/home.aspx

    "Dot net work" <> wrote in message
    news:...
    > 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.
    Peter Blum, May 11, 2004
    #2
    1. Advertising

  3. Dot net work

    Dot net work Guest

    Thanks very much for the info.

    "Peter Blum" <> wrote in message news:<>...
    > 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:
    > Creator of "Professional Validation And More" at
    > http://www.peterblum.com/vam/home.aspx
    >
    > "Dot net work" <> wrote in message
    > news:...
    > > 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.
    Dot net work, May 12, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Duwayne
    Replies:
    1
    Views:
    1,599
    MS News \(MS ILM\)
    Aug 20, 2003
  2. tshad
    Replies:
    4
    Views:
    6,212
    tshad
    Mar 1, 2005
  3. Ben
    Replies:
    1
    Views:
    592
    SevDer
    Jul 28, 2005
  4. Matt Sokol
    Replies:
    2
    Views:
    366
    Theo Tillotson
    Aug 7, 2003
  5. Scott Yenor

    How to get custom control to work with custom validator

    Scott Yenor, Jan 27, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    201
    Scott Yenor
    Jan 27, 2004
Loading...

Share This Page