0

I have a drop down in my form.

I don't want my form to be submitted when a particular item in my dropdown is selected (based on some remote logic that I'm handling manually using some Ajax calls).

I prefer not to use jQuery validation remote rule, because of it's async nature (some times form is submitted when the remote rule is still working: Using jQuery validator's valid() or element() method with remote methods).

Where should I start? Do I need to add a custom rule?

jQuery Validate Plugin - How to create a simple custom rule?

or just adding my errors is sufficient?

$('form').validate().showErrors({
  "firstname": "I know that your firstname is Pete, Pete!"
});

or something else?

2
  • "Where should I start?" : By reading the documentation and trying something. Then show us enough code to reproduce the problem if/when you get stuck. As it stands, your question is incredibly broad and lacking enough relevant code. Yes, if the rule is not already built into the plugin, use .addMethod() to write your own. Commented May 9, 2015 at 3:03
  • @Sparky Cool down bro. Don't lynch me!. I've read the [the documentation] (jqueryvalidation.org). My project is being developed using Asp.ne MVC, WebAPI, MS Sql, KnockoutJS, etc, I have a little problem with jQuery validation. Posting the whole thing is not going to do any good. My problem is with 'showErrors()' not working as expected. I just want some outer perspective regarding my problem. Commented May 9, 2015 at 21:59

0

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.