Jquery掩码和验证不起作用

时间:2015-06-23 21:33:08

标签: javascript jquery jquery-validate

因此,如果' newseasons'工作得很好,但是很老的原因'不要让我放8个标志,所以1.0.0.10它预计9,即使我将minlength设置为8,maxlength设置为9,并且关于长度的警告也没有显示但是它们与oldseasons部分一起工作正常。似乎在这两者之间切换并不更新jquery验证中的消息和限制。

function checkseason(){
                                d = document.getElementById("season").value;

                                                $('#first_form').validate({
                                                        rules: {
                                                                patch: {
                                                                        required: true
                                                                        remote: {
                                                                                url: "../checkpatch.php",
                                                                                type: "post"
                                                                                }
                                                                        }
                                                                },
                                                        messages: {
                                                                patch: {
                                                                        required: "Please enter patch version.",
                                                                        remote: "Patch with this number already exists.",
                                                                        minlength: "Please enter 3 numbers"
                                                                        }
                                                                },

                                                });

                                        if(d==='newseasons'){
                                                $('#first_form').rules('add', {
                                                        minlength: 4
                                                });

                                                $("#patch").mask("x.xx", {
                                                        placeholder: ""
                                                });
                                        }

                                        else if(d==='oldseasons'){
                                                $('#first_form').rules('add', {
                                                        minlength: 8,
                                                        maxlength: 9
                                                });

                                                $("#patch").mask("x.x.x.xxx", {
                                                        placeholder: ""
                                                });
                                        }


                        }

UPDATE仍然无效,但我认为这是从我在堆栈上阅读的其他帖子中找到正确方法

set.seed(1); 
dt<-data.table(form=c(1,1,1,2,3,3,3,4,4,5),
    mx=c("a","b","c","d","e","f","g","e","g","b"),
    vr=runif(10,100,200),
    usr=c("l","l","l","m","o","o","o","l","l","m"),
    type=c("A","A","A","C","C","C","C","C","C","A"))

0 个答案:

没有答案