RequiredFieldValidator fired when no validation needed

Discussion in 'ASP .Net' started by Vik, Apr 5, 2009.

  1. Vik

    Vik Guest

    In VS 2005, on a page there is a dropdownlist and a RequiredFieldValidator
    for that list. There are also two buttons - an "Add" button with
    CausesValidation = True and a "Search" button with CausesValidation = False.

    The first value in the dropdownlist is Null. If I select some value in the
    DDL and then select Null in this list, then the RequiredFieldValidator
    immidiately displays a message though no button was clicked and no
    validation should be done at this time. If I click the Search button, the
    validator disappears and search is executed.

    How can I make the validator to fire only when the page is submitted (that
    was a behavior in VS 2003)?

    Thanks.
     
    Vik, Apr 5, 2009
    #1
    1. Advertising

  2. Vik

    Scott M. Guest

    Validators have always triggered their validation when you either submit the
    form or the control to validate loses its focus. This is not new behavior
    (it worked like this in VS 2003).

    If you don't want the validation when the control loses the focus, you'll
    have to write your own validator.

    -Scott

    "Vik" <viktorum@==yahoo.com==> wrote in message
    news:...
    > In VS 2005, on a page there is a dropdownlist and a RequiredFieldValidator
    > for that list. There are also two buttons - an "Add" button with
    > CausesValidation = True and a "Search" button with CausesValidation =
    > False.
    >
    > The first value in the dropdownlist is Null. If I select some value in the
    > DDL and then select Null in this list, then the RequiredFieldValidator
    > immidiately displays a message though no button was clicked and no
    > validation should be done at this time. If I click the Search button, the
    > validator disappears and search is executed.
    >
    > How can I make the validator to fire only when the page is submitted (that
    > was a behavior in VS 2003)?
    >
    > Thanks.
    >
    >
     
    Scott M., Apr 5, 2009
    #2
    1. Advertising

  3. Vik

    Vik Guest

    You are right, the same behavior is in VS2003. Thanks.

    Vik

    "Scott M." <> wrote in message
    news:e%...
    > Validators have always triggered their validation when you either submit
    > the form or the control to validate loses its focus. This is not new
    > behavior (it worked like this in VS 2003).
    >
    > If you don't want the validation when the control loses the focus, you'll
    > have to write your own validator.
    >
    > -Scott
    >
    > "Vik" <viktorum@==yahoo.com==> wrote in message
    > news:...
    >> In VS 2005, on a page there is a dropdownlist and a
    >> RequiredFieldValidator for that list. There are also two buttons - an
    >> "Add" button with CausesValidation = True and a "Search" button with
    >> CausesValidation = False.
    >>
    >> The first value in the dropdownlist is Null. If I select some value in
    >> the DDL and then select Null in this list, then the
    >> RequiredFieldValidator immidiately displays a message though no button
    >> was clicked and no validation should be done at this time. If I click the
    >> Search button, the validator disappears and search is executed.
    >>
    >> How can I make the validator to fire only when the page is submitted
    >> (that was a behavior in VS 2003)?
    >>
    >> Thanks.
    >>
    >>

    >
    >
     
    Vik, Apr 6, 2009
    #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. D. Shane Fowlkes
    Replies:
    2
    Views:
    5,952
    Martin Dechev
    Feb 23, 2004
  2. Christian Ista
    Replies:
    5
    Views:
    3,187
    Johann MacDonagh
    Dec 7, 2004
  3. mallik
    Replies:
    3
    Views:
    762
    =?Utf-8?B?bG9uZG9uIGNhbGxpbmc=?=
    Jul 7, 2005
  4. JP2006
    Replies:
    1
    Views:
    413
    JP2006
    Aug 23, 2006
  5. Christina
    Replies:
    2
    Views:
    1,584
    Christina
    Nov 13, 2006
Loading...

Share This Page