流星验证规则和消息指示?

时间:2014-04-03 17:41:46

标签: meteor

我需要了解下面代码中提到的流星规则和消息的用法。我理解下面功能的功能,但我对执行和使用情况一无所知您可以检查下面的代码一次,并建议我执行程序,以及何时执行验证方法以及如何显示以下消息文本。如何校准以下方法。我做了以下方法,如

 setUpValidators();

我得到错误来调整方法。错误是

[23:12:01.389] $("#addnewuserdetails").validate is not a function @ http://localhost:3000/app.js?92269b7057a5ba1050e9caeddd680fbe336aeb57:76

    var setUpValidators = function() {
        // set up validations

       console.log(">>>>>>>>>>>>>>>>>>> setUpValidators");
        var validator = $('#addnewuserdetails').validate({   //addnewuserdetails is form id name
            rules: {
                "userid": {  //userid is textfiled id name
                    required: true,
                    minlength: 5,
                    maxlength: 50
                },
                "phno": {
                    maxlength: 10
                }
            },
            messages:
               {
                "userid": 
                 {
                    required: "Please enter a userid",
                    minlength: "The title must be at least 5 characters long",
                    maxlength: "The title must be no more than 50 characters long"
                   },
                "phno": 
                  {
                    maxlength: "The title must be no more than 250 characters long"
                   }
            }

        });
    };

0 个答案:

没有答案
相关问题