0

How to force MVC-5 client side engine to validate the form with out using submit button?

I have one button and one check box in the form, I want to get validate the form when I click on the button or press the check box. The type of button is not submit.

6
  • If the button is not submit then how can you use it to submit form? Commented Sep 12, 2014 at 10:53
  • 2
    Check out the jQuery Validator, specifically the validate() function. Commented Sep 12, 2014 at 10:53
  • <input id="placeorderbtn" type="submit" value="Place Order Now " onclick="this.form.action='example.com';this.form.submit();" > Commented Sep 12, 2014 at 10:54
  • why don't you use unobstructive jquery? Commented Sep 12, 2014 at 10:56
  • I am using unobstructive jquery for remote validation. But now I want to validate the model which is attach to the view. The button is dynamically created (some times more than one button will be created dynamically and I want to do model validation if the user press any one of the button) Commented Sep 12, 2014 at 11:05

1 Answer 1

4
var form = document.forms[0];
$(form).validate();
if(!$(form).valid()){
          alert("Error's in the module");
          return;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.