I'm validating a form using the new unobtrusive validation features in ASP.NET MVC 3.
So there is no code that I have written to setup jQuery validate to start validating my form. Its all done by loading the jQuery.validate.unobtrusive.js library.
Unfortunately I need to whack in a 'are you sure?' message box when the form is valid but before submitting. With jQuery validate you would add the option handleSubmit when initialising like so:
$("#my_form").validate({
rules: {
field1: "required",
field1: {email: true },
field2: "required"
},
submitHandler: function(form) {
if(confirm('Are you sure?')) {
form.submit();
}
}
});
But you don't need to initialise when using the unobtrusive library.
Any ideas where/how I can add a submit handler in that case?
Thx
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…