disable requiredfieldvalidator when clicking on submit button

Discussion in 'ASP .Net' started by James Brett, Nov 25, 2003.

  1. James Brett

    James Brett Guest

    I have one form on the page but have multiple submit buttons for different
    elements. When clicking on a button not associated with the required
    elements the validator popup still comes up.

    How can I disable requiredfieldvalidator fields when I click on non
    associated button?

    Cheers
    James
    James Brett, Nov 25, 2003
    #1
    1. Advertising

  2. James,

    That depends. If the button does not have to be associated with any
    validators on the page at all then you can set the button's CausesValidation
    property to false.

    If the button has to trigger some validators but not others then you'll have
    to create a javascript that fires when the button is clicked. The javascript
    would then have to set each validator's "enabled" attribute to false (in the
    client side code) for each validator that shouldn't fire.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "James Brett" <> wrote in message
    news:...
    > I have one form on the page but have multiple submit buttons for different
    > elements. When clicking on a button not associated with the required
    > elements the validator popup still comes up.
    >
    > How can I disable requiredfieldvalidator fields when I click on non
    > associated button?
    >
    > Cheers
    > James
    >
    >
    >
    S. Justin Gengo, Nov 25, 2003
    #2
    1. Advertising

  3. Set the CausesValidation attribute for the 'non-associated' Button to false.

    Cheers,
    Wim Hollebrandse
    http://www.wimdows.net
    http://www.wimdows.com

    "James Brett" <> wrote in message
    news:...
    > I have one form on the page but have multiple submit buttons for different
    > elements. When clicking on a button not associated with the required
    > elements the validator popup still comes up.
    >
    > How can I disable requiredfieldvalidator fields when I click on non
    > associated button?
    >
    > Cheers
    > James
    >
    >
    >
    Wim Hollebrandse, Nov 25, 2003
    #3
  4. James Brett

    James Brett Guest

    How is this done when the button already has an onClick event for the
    validator? eg

    <input type="submit" name="btnDataset" value="Update Dataset" onclick="if
    (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
    language="javascript" id="btnDataset" class="button" />

    Cheers
    James


    "S. Justin Gengo" <> wrote in message
    news:...
    > James,
    >
    > That depends. If the button does not have to be associated with any
    > validators on the page at all then you can set the button's

    CausesValidation
    > property to false.
    >
    > If the button has to trigger some validators but not others then you'll

    have
    > to create a javascript that fires when the button is clicked. The

    javascript
    > would then have to set each validator's "enabled" attribute to false (in

    the
    > client side code) for each validator that shouldn't fire.
    >
    > --
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    > Web Developer / Programmer
    >
    > Free code library at:
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzche
    >
    >
    > "James Brett" <> wrote in message
    > news:...
    > > I have one form on the page but have multiple submit buttons for

    different
    > > elements. When clicking on a button not associated with the required
    > > elements the validator popup still comes up.
    > >
    > > How can I disable requiredfieldvalidator fields when I click on non
    > > associated button?
    > >
    > > Cheers
    > > James
    > >
    > >
    > >

    >
    >
    James Brett, Nov 26, 2003
    #4
  5. James Brett

    James Brett Guest

    All working fine now

    Cheers
    James



    "James Brett" <> wrote in message
    news:%...
    > How is this done when the button already has an onClick event for the
    > validator? eg
    >
    > <input type="submit" name="btnDataset" value="Update Dataset" onclick="if
    > (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
    > language="javascript" id="btnDataset" class="button" />
    >
    > Cheers
    > James
    >
    >
    > "S. Justin Gengo" <> wrote in message
    > news:...
    > > James,
    > >
    > > That depends. If the button does not have to be associated with any
    > > validators on the page at all then you can set the button's

    > CausesValidation
    > > property to false.
    > >
    > > If the button has to trigger some validators but not others then you'll

    > have
    > > to create a javascript that fires when the button is clicked. The

    > javascript
    > > would then have to set each validator's "enabled" attribute to false (in

    > the
    > > client side code) for each validator that shouldn't fire.
    > >
    > > --
    > > Sincerely,
    > >
    > > S. Justin Gengo, MCP
    > > Web Developer / Programmer
    > >
    > > Free code library at:
    > > www.aboutfortunate.com
    > >
    > > "Out of chaos comes order."
    > > Nietzche
    > >
    > >
    > > "James Brett" <> wrote in message
    > > news:...
    > > > I have one form on the page but have multiple submit buttons for

    > different
    > > > elements. When clicking on a button not associated with the required
    > > > elements the validator popup still comes up.
    > > >
    > > > How can I disable requiredfieldvalidator fields when I click on non
    > > > associated button?
    > > >
    > > > Cheers
    > > > James
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
    James Brett, Nov 26, 2003
    #5
    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. Ghafran Abbas
    Replies:
    0
    Views:
    4,178
    Ghafran Abbas
    Oct 12, 2004
  2. Network-Man
    Replies:
    5
    Views:
    78,205
    gaul1
    Jul 7, 2012
  3. Paul Oakfleet
    Replies:
    1
    Views:
    834
    Chris Riesbeck
    Sep 10, 2003
  4. Chuck
    Replies:
    0
    Views:
    249
    Chuck
    Nov 10, 2003
  5. ljlolel
    Replies:
    2
    Views:
    492
Loading...

Share This Page