This project is read-only.

Multiple submit buttons on a single form and causesvalidation flag

Jun 23, 2009 at 8:13 AM


Is it possible to have multiple buttons on a single form (eg. Save/Cancel) and ignore xVal client side validation on one of them (like causesvalidation=false)  ?



Jun 23, 2009 at 8:31 AM


You could just move one of the buttons outside of the form tag so that then it wouldn't post the form when the user clicked it. You could also detect which button was pressed in Javascript and disable the form validation using the jquery.validate api.

Can you give any further explantion on your requirements.

Thanks, Mark

Jun 23, 2009 at 9:09 AM
Edited Jun 23, 2009 at 9:53 AM

Hi Mark,

Thanks for your quick turn around..1st option ( moving button outside form tag) won't be feasible always because of design constraints.

2nd one would be ideal, could  you provide a code snippent on this?


Jun 23, 2009 at 10:05 AM

Hi Mark

I just figured out a way to suppress validation on one of the buttons by setting a css class called "cancel" for that button.. looks like jQuery will ignore buttons with "cancel" css class.

Not sure whether this is the right way :(