I've got a RequiredFieldValidator on a contact form.
It works as intended when people click 'Submit', but if they click 'Cancel' or any of the multiple menus on my form, the RequiredFieldValidator cancels the action.
I have already searched and found that I need to set the other controls on my form using CausesValidation = False (using this post), but do I have to do that for every control on my page?
What makes it worse is that the menus on my form are contained in a Master.Page, and they are mostly <DIV>
style CSS buttons, but clicking any of the buttons causes the RequiredFieldValidator to fire and fail the form.
Shouldn't the default be False and I have to turn on which control sets the validation?
You only need to set:
To your buttons performing an action
As an alternative, you could add a
ValidationGroup
attribute to your controls and buttons to control which buttons raise the validation. Only the controls matching theValidationGroup
specified will be validatedyou can set validation groups
came from here
Edit , sorry I didn't put put this in code properly and it didn't display:
Or you can always use and handle those on client side if they are just cancel and stuff like that