validform动态切换datatype提示信息错误

问题:输入框的datatype为htjes,输入A,然后提示格式错误

  然后动态切换datatype为htjem,此时输入框中的值为A,符合htjem的正则,验证通过,但是提示信息还是格式错误,本应该提示:通过信息验证!

分析:

check : function(curform, brothers, subpost, bool) {var settings = brothers.settings;
            var subpost = subpost || "";
            var inputval = Validform.util.getValue.call(curform, $(this));
            if (settings.ignoreHidden && $(this).is(":hidden")
                    || $(this).data("dataIgnore") === "dataIgnore") {
                return true;
            }
            if (settings.dragonfly && !$(this).data("cked")
                    && Validform.util.isEmpty.call($(this), inputval)
                    && $(this).attr("ignore") != "ignore") {
                return false;
            }
            var flag = Validform.util.regcheck.call(curform, $(this).attr(
                    "datatype"), inputval, $(this));//此处每次都可返回正常的提示信息
            if (inputval == this.validform_lastval && !$(this).attr("recheck")
                    && subpost == "") {//当this.validform==inputval的时候直接就退出了,后面提示信息显示的代码没有执行
                return flag.passed ? true : false;
            }
            this.validform_lastval = inputval;//问题主要在这句,第一次验证后此处进行赋值,导致inputval==this.validform_lastval一直成立,所以新的提示信息无法正常显示就return了
            var _this;
            errorobj = _this = $(this);
            if (!flag.passed) {
                Validform.util.abort.call(_this[0]);
                if (!bool) {//进行提示信息的显示
                    Validform.util.showmsg.call(curform, flag.info,
                            settings.tiptype, {
                                obj : $(this),
                                type : flag.type,
                                sweep : settings.tipSweep
                            }, "bycheck");
                    !settings.tipSweep && _this.addClass("Validform_error");
                }
                return false;
            }

 

解决办法:

  找到源码中的check : function(curform, brothers, subpost, bool),大概在672行,第一行添加:this.validform_lastval = null;

 

posted @ 2016-12-09 17:23  暗夜心慌方  阅读(225)  评论(0)    收藏  举报