disable requiredfieldvalidator when clicking on submit button

  • Thread starter Thread starter James Brett
  • Start date Start date
J

James Brett

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,

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
 
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
 
All working fine now

Cheers
James



James Brett said:
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
 
Back
Top