javascript - about validate.js use function -


            "data[researchcase][sender_mail]": {             required: function() {                  return $("#customer_info").val() =="2";             },             email: function() {                  return $("#customer_info").val() =="2";             }         }         messages: {          "data[researchcase][sender_mail]": {             required: "must input mail",             email:"not right email"          }         } 

when customer_info = 1. required validate not work,but email validate work。 try wirte

email:function(){retrun false} or email:function(){retrun 0} 

also not work try delete required validate, email work. wrong?

hoho, know why in validate.js email check not have parameters old code

        email: function(value, element) {         return this.optional(element) || /^(((....)))\.?$/i.test(value);     }, 

the new code

        email: function(value, element, param) {         if (!param) {             return true;         }         return this.optional(element) || /^(((....)))\.?$/i.test(value);     }, 

when customer_info = 1 ,the eamil validate not work. have other question,when wirte eamil:false, email validate not work,so diffrent

email:function(){return false} 

to

email:false 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -