Jquery validation remote depends verification trigger condition, jqueryvalidation

Source: Internet
Author: User

Jquery validation remote depends verification trigger condition, jqueryvalidation

Background:

1: data modification page;

2: email cannot be repeated


On the modify page, the mailbox is taken out by default, but the field has remote verification, which cannot be repeated. If the focus is lost in the mailbox input box, remote verification is triggered by default,


Introduction complete





Solution:

Remote verification is not triggered when the mailbox does not change;


After turning over the issues plug-in on github, you can see an article https://github.com/jzaeffer/jquery-validation/issues/431,the idea of a perfect solution,

email:{required : true,email : true,maxlength : 100,remote : {depends : function(element) {                return element.value !== "${client.email}";            },param : {url : "${ctx}/account/checkEmail",cache :false}}}




Jquery validation remote verifies Email. The returned value is correct, but the error message is unrealistic.

Wrong understanding
When jquery validation remote returns true, it indicates the result is successful, so no prompt is displayed.
For example, if the input is a test@example.com, the returned false will prompt Already subscribed.

Why does jquery-validation remote only return True false and no error message is displayed?

Have you set message for remote. Like this:
Rules: {"oauser. ssourl": {required: true, url: true, remote: "user/user! CheckUrl. action "}}, messages: {" oauser. ssourl ": {remote:" enter the correct OA address "}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.