mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Issue 1905 support the conditional statement of ruleset on radiobox and checkbox.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10564 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
db95166c4d
commit
4566d43b38
3 changed files with 18 additions and 14 deletions
|
|
@ -1779,7 +1779,6 @@ var Validator = xe.createApp('Validator', {
|
|||
API_VALIDATE : function(sender, params) {
|
||||
var result = true, form = params[0], elems = form.elements, filter, filter_to_add, ruleset, callback;
|
||||
var fields, names, name, el, val, mod, len, lenb, max, min, maxb, minb, rules, e_el, e_val, i, c, r, if_, fn;
|
||||
|
||||
if(elems['ruleset']) filter = form.elements['ruleset'].value;
|
||||
else if(elems['_filter']) filter = form.elements['_filter'].value;
|
||||
if(!filter) return true;
|
||||
|
|
@ -1844,8 +1843,11 @@ var Validator = xe.createApp('Validator', {
|
|||
if(!$.isArray(f['if'])) f['if'] = [f['if']];
|
||||
for(i=0;i<f['if'].length;i++) {
|
||||
if_ = f['if'][i];
|
||||
fn = new Function('el', 'return !!(' + (if_.test.replace(/\$(\w+)/g, 'el["$1"].value')) +')');
|
||||
fn = new Function('el', 'return !!(' + (if_.test.replace(/\$(\w+)/g, '(jQuery(\'[name=$1]\').is(\':radio, :checkbox\') ? jQuery(\'[name=$1]:checked\').val() : jQuery(\'[name=$1]\').val())')) +')');
|
||||
//fn = new Function('el', 'return !!(' + (if_.test.replace(/\$(\w+)/g, 'el["$1"].value')) +')');
|
||||
if(fn(elems)) f[if_.attr] = if_.value;
|
||||
else delete f[if_.attr];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
20
common/js/xe.min.js
vendored
20
common/js/xe.min.js
vendored
|
|
@ -54,22 +54,22 @@ d:l.join(""))+"}"}else e="string"==typeof a?e+((b&&":")+'"'+a.toString()+'"'):e+
|
|||
a.nodeValue:4==a.nodeType&&(b+="<![CDATA["+a.nodeValue+"]]\>");return b},a=a.firstChild;a;a=a.nextSibling)b+=c(a);return b},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();for(var b=a.firstChild;b;)if(3==b.nodeType)if(b.nodeValue.match(/[^ \f\n\r\t\v]/))b=b.nextSibling;else{var d=b.nextSibling;a.removeChild(b);b=d}else 1==b.nodeType&&c.removeWhite(b),b=b.nextSibling;return a}};9==a.nodeType&&
|
||||
(a=a.documentElement);var e=c.toObj(c.removeWhite(a));"object"==typeof JSON&&jQuery.isFunction(JSON.stringify);a=c.toJson(e,a.nodeName,"");return"{"+(b?a.replace(/\t/g,b):a.replace(/\t|\n/g,""))+"}"}
|
||||
(function(a){function b(b,c){a("#xeTmpIframe").length||a('<iframe name="%id%" id="%id%" style="position:absolute;left:-1px;top:1px;width:1px;height:1px"></iframe>'.replace(/%id%/g,"xeTmpIframe")).appendTo(document.body);a("#xeVirtualForm").remove();var d=a('<form id="%id%"></form>'.replace(/%id%/g,"xeVirtualForm")).attr({id:"xeVirtualForm",method:"post",action:b,target:"xeTmpIframe"});c.xeVirtualRequestMethod="xml";c.xeRequestURI=location.href.replace(/#(.*)$/i,"");c.xeVirtualRequestUrl=request_uri;
|
||||
a.each(c,function(b,c){a('<input type="hidden">').attr("name",b).attr("value",c).appendTo(d)});d.appendTo(document.body).submit()}function d(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function c(){return""}a.exec_xml=window.exec_xml=function(c,g,i,j,k,l,h){function t(b){var b=a(b).find("response")[0],d,t="",n=[],i={};d="";r.css("display","none").trigger("cancel_confirm");if(!b)return alert(u.responseText),null;d=xml2json(b,!1,!1);d="object"==typeof JSON&&a.isFunction(JSON.parse)?
|
||||
a.each(c,function(b,c){a('<input type="hidden">').attr("name",b).attr("value",c).appendTo(d)});d.appendTo(document.body).submit()}function d(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function c(){return""}a.exec_xml=window.exec_xml=function(c,g,i,j,k,l,h){function t(b){var b=a(b).find("response")[0],d,t="",n=[],i={};d="";s.css("display","none").trigger("cancel_confirm");if(!b)return alert(u.responseText),null;d=xml2json(b,!1,!1);d="object"==typeof JSON&&a.isFunction(JSON.parse)?
|
||||
JSON.parse(d):eval("("+d+")");d=d.response;if("undefined"==typeof d){n.error=-1;n.message="Unexpected error occured.";try{if("undefined"!=typeof(t=b.childNodes[0].firstChild.data))n.message+="\r\n"+t}catch(m){}return n}a.each(k,function(a,b){i[b]=!0});i.redirect_url=!0;i.act=!0;a.each(d,function(a,b){i[a]&&(n[a]=b)});if(0!=n.error){if(a.isFunction(a.exec_xml.onerror))return a.exec_xml.onerror(c,g,n,j,k,l,h);alert((n.message||"An unknown error occured while loading ["+c+"."+g+"]").replace(/\\n/g,"\n"));
|
||||
return null}if(n.redirect_url)return location.href=n.redirect_url.replace(/&/g,"&"),null;a.isFunction(j)&&j(n,k,l,h)}var n=request_uri+"index.php";i||(i={});a.isArray(i)&&(i=d(i));i.module=c;i.act=g;"undefined"!=typeof xeVid&&(i.vid=xeVid);"undefined"==typeof k||1>k.length?k=["error","message"]:k.push("error","message");if(a.isArray(ssl_actions)&&i.act&&0<=a.inArray(i.act,ssl_actions)){var n=window.https_port||443,m=a("<a>").attr("href",default_url||request_uri)[0],v="https://"+m.hostname.replace(/:\d+$/,
|
||||
"");443!=n&&(v+=":"+n);"/"!=m.pathname[0]&&(v+="/");v+=m.pathname;n=v.replace(/\/$/,"")+"/index.php"}m=a("<a>").attr("href",location.href)[0];v=a("<a>").attr("href",n)[0];if(m.protocol!=v.protocol||m.port!=v.port)return b(n,i);var w=[],o=0;w[o++]='<?xml version="1.0" encoding="utf-8" ?>';w[o++]="<methodCall>";w[o++]="<params>";a.each(i,function(a,b){w[o++]="<"+a+"><![CDATA["+b+"]]\></"+a+">"});w[o++]="</params>";w[o++]="</methodCall>";var u=null;u&&0!=u.readyState&&u.abort();try{a.ajax({url:n,type:"POST",
|
||||
dataType:"xml",data:w.join("\n"),contentType:"text/plain",beforeSend:function(a){u=a},success:t,error:function(a,b){r.css("display","none");var c="";if("parsererror"==b){if(""==a.responseText)return;c="The result is not valid XML :\n-------------------------------------\n"+a.responseText.replace(/<[^>]+>/g,"")}else c=b;try{console.log(c)}catch(d){}}})}catch(z){alert(z);return}var r=a(".wfsr");show_waiting_message&&r.length&&r.html(waiting_message).show()};a.exec_json=function(b,c,d){"undefined"==
|
||||
dataType:"xml",data:w.join("\n"),contentType:"text/plain",beforeSend:function(a){u=a},success:t,error:function(a,b){s.css("display","none");var c="";if("parsererror"==b){if(""==a.responseText)return;c="The result is not valid XML :\n-------------------------------------\n"+a.responseText.replace(/<[^>]+>/g,"")}else c=b;try{console.log(c)}catch(d){}}})}catch(z){alert(z);return}var s=a(".wfsr");show_waiting_message&&s.length&&s.html(waiting_message).show()};a.exec_json=function(b,c,d){"undefined"==
|
||||
typeof c&&(c={});b=b.split(".");2==b.length&&(show_waiting_message&&a(".wfsr").html(waiting_message).show(),a.extend(c,{module:b[0],act:b[1]}),"undefined"!=typeof xeVid&&a.extend(c,{vid:xeVid}),a.ajax({type:"POST",dataType:"json",url:request_uri,contentType:"application/json",data:a.param(c),success:function(b){a(".wfsr").hide().trigger("cancel_confirm");0<b.error&&alert(b.message);a.isFunction(d)&&d(b)}}))};a.fn.exec_html=function(b,c,d,j,k){"undefined"==typeof c&&(c={});a.inArray(d,["html","append",
|
||||
"prepend"])||(d="html");var l=a(this),b=b.split(".");2==b.length&&(show_waiting_message&&a(".wfsr").html(waiting_message).show(),a.extend(c,{module:b[0],act:b[1]}),a.ajax({type:"POST",dataType:"html",url:request_uri,data:a.param(c),success:function(b){a(".wfsr").hide().trigger("cancel_confirm");l[d](b);a.isFunction(j)&&j(k)}}))};a(function(a){a(".wfsr").ajaxStart(function(){a(window).bind("beforeunload",c)}).bind("ajaxStop cancel_confirm",function(){a(window).unbind("beforeunload",c)})})})(jQuery);
|
||||
(function(a){function b(a){var b=[];return a.is(":radio")?a.filter(":checked").val():a.is(":checkbox")?(a.filter(":checked").each(function(){b.push(this.value)}),b.join("|@|")):a.val()}function d(a){a+="";if(!a.length)return 0;var a=encodeURI(a),b=a.split("%").length-1;return a.length-2*b}var c=[],e=[],g={},i=[],j={},k=new (xe.createApp("Validator",{init:function(){var a=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;this.cast("ADD_RULE",["email",a]);this.cast("ADD_RULE",["email_address",a]);a=/^[a-z]+[\w-]*[a-z0-9_]+$/i;
|
||||
this.cast("ADD_RULE",["userid",a]);this.cast("ADD_RULE",["user_id",a]);a=/^(https?|ftp|mms):\/\/[0-9a-z-]+(\.[_0-9a-z-]+)+(:\d+)?/;this.cast("ADD_RULE",["url",a]);this.cast("ADD_RULE",["homepage",a]);this.cast("ADD_RULE",["korean",RegExp("^[\uac00-\ud7a3]*$")]);this.cast("ADD_RULE",["korean_number",RegExp("^[\uac00-\ud7a30-9]*$")]);this.cast("ADD_RULE",["alpha",/^[a-z]*$/i]);this.cast("ADD_RULE",["alpha_number",/^[a-z][a-z0-9_]*$/i]);this.cast("ADD_RULE",["number",/^[0-9]*$/])},run:function(a){var b=
|
||||
"";a._filter&&(b=a._filter.value);a=this.cast("VALIDATE",[a,b]);"undefined"==typeof a&&(a=!1);return a},API_ONREADY:function(){var b=this;a("form").each(function(){this.onsubmit&&(this["xe:onsubmit"]=this.onsubmit,this.onsubmit=null)}).submit(function(c){var d=this["xe:onsubmit"];(d=a.isFunction(d)?d.apply(this):b.run(this))||c.stopImmediatePropagation();return d})},API_VALIDATE:function(c,e){function n(a){return a.replace(/([\.\+\-\[\]\{\}\(\)\\])/g,"\\$1")}var m=!0,l=e[0],k=l.elements,o,u,z,r,q,
|
||||
p,A,s,x,y;k.ruleset?o=l.elements.ruleset.value:k._filter&&(o=l.elements._filter.value);if(!o)return!0;a.isFunction(i[o])&&(z=i[o]);o=a.extend({},g[o.toLowerCase()]||{},j);r=[];p=0;for(s=l.elements.length;p<s;p++)m=k[p],(q=m.name)&&k[q]&&(!k[q].length||k[q][0]===m)&&r.push(q);r=r.join("\n");u={};for(q in o)if(o.hasOwnProperty(q)&&(m=[],"^"==q.substr(0,1))){(m=r.match(RegExp("^"+n(q.substr(1))+".*$","gm")))||(m=[]);p=0;for(s=m.length;p<s;p++)u[m[p]]=o[q];o[q]=null;delete o[q]}o=a.extend(o,u);for(q in o)if(o.hasOwnProperty(q)&&
|
||||
(f=o[q],(m=k[q])||(m=k[q+"[]"]),r=m?a.trim(b(a(m))):"",u=(f.modifier||"")+",",m&&!m.disabled)){if(f["if"]){a.isArray(f["if"])||(f["if"]=[f["if"]]);for(p=0;p<f["if"].length;p++)s=f["if"][p],m=new Function("el","return !!("+s.test.replace(/\$(\w+)/g,'el["$1"].value')+")"),m(k)&&(f[s.attr]=s.value)}if(r){m=parseInt(f.minlength)||0;s=parseInt(f.maxlength)||0;y=/b$/.test(f.minlength||"");x=/b$/.test(f.maxlength||"");p=r.length;if(y||x)A=d(r);if(m&&m>(y?A:p)||s&&s<(x?A:p))return this.cast("ALERT",[l,q,
|
||||
"outofrange",m,s])&&!1;if(f.equalto&&(s=(p=k[f.equalto])?a.trim(b(a(p))):"",p&&s!==r))return this.cast("ALERT",[l,q,"equalto"])&&!1;x=(f.rule||"").split(",");p=0;for(s=x.length;p<s;p++)if(y=x[p])if(m=this.cast("APPLY_RULE",[y,r]),-1<u.indexOf("not,")&&(m=!m),!m)return this.cast("ALERT",[l,q,"invalid_"+y])&&!1}else if(f["default"]&&(r=f["default"]),f.required)return this.cast("ALERT",[l,q,"isnull"])&&!1}return a.isFunction(z)?z(l):!0},API_ADD_RULE:function(a,b){var c=b[0].toLowerCase();e[c]=b[1]},
|
||||
API_DEL_RULE:function(a,b){var c=b[0].toLowerCase();delete e[c]},API_GET_RULE:function(a,b){var c=b[0].toLowerCase();return e[c]?e[c]:null},API_ADD_FILTER:function(a,b){var c=b[0].toLowerCase();g[c]=b[1]},API_DEL_FILTER:function(a,b){var c=b[0].toLowerCase();delete g[c]},API_GET_FILTER:function(a,b){var c=b[0].toLowerCase();return g[c]?g[c]:null},API_ADD_EXTRA_FIELD:function(a,b){var c=b[0].toLowerCase();j[c]=b[1]},API_GET_EXTRA_FIELD:function(a,b){var c=b[0].toLowerCase();return j[c]},API_DEL_EXTRA_FIELD:function(a,
|
||||
b){var c=b[0].toLowerCase();delete j[c]},API_APPLY_RULE:function(b,c){var d=c[0],g=c[1];return"undefined"==typeof e[d]?!0:a.isFunction(e[d])?e[d](g):e[d]instanceof RegExp?e[d].test(g):a.isArray(e[d])?-1<a.inArray(g,e[d]):!0},API_ALERT:function(b,c){var d=c[0],e=c[1],g=c[2],i=c[3],k=c[4],l=this.cast("GET_MESSAGE",[e]),j=this.cast("GET_MESSAGE",[g]);j!=g&&(j=0>j.indexOf("%s")?l+j:j.replace("%s",l));if(i||k)j+="("+(i||"")+"~"+(k||"")+")";this.cast("SHOW_ALERT",[j]);a(d.elements[e]).focus()},API_SHOW_ALERT:function(a,
|
||||
b){alert(b[0])},API_ADD_MESSAGE:function(a,b){c[b[0]]=b[1]},API_GET_MESSAGE:function(a,b){var d=b[0];return c[d]||d},API_ADD_CALLBACK:function(a,b){i[b[0]]=b[1]},API_REMOVE_CALLBACK:function(a,b){delete i[b[0]]}}));xe.registerApp(k);var l=xe.createPlugin("editor_stub",{API_BEFORE_VALIDATE:function(a,b){var c=b[0].getAttribute("editor_sequence");c&&"object"==typeof c&&(c=c.value);if(c)try{editorRelKeys[c].content.value=editorRelKeys[c].func(c)||""}catch(d){}}});k.registerPlugin(new l)})(jQuery);
|
||||
function filterAlertMessage(a){var b=a.message,d=a.act,a=a.redirect_url,c=location.href;"undefined"!=typeof b&&b&&"success"!=b&&alert(b);"undefined"!=typeof d&&d?c=current_url.setQuery("act",d):"undefined"!=typeof a&&a&&(c=a);c==location.href&&(c=c.replace(/#(.*)$/,""));location.href=c}function procFilter(a,b){b(a);return!1}
|
||||
"";a._filter&&(b=a._filter.value);a=this.cast("VALIDATE",[a,b]);"undefined"==typeof a&&(a=!1);return a},API_ONREADY:function(){var b=this;a("form").each(function(){this.onsubmit&&(this["xe:onsubmit"]=this.onsubmit,this.onsubmit=null)}).submit(function(c){var d=this["xe:onsubmit"];(d=a.isFunction(d)?d.apply(this):b.run(this))||c.stopImmediatePropagation();return d})},API_VALIDATE:function(c,e){function n(a){return a.replace(/([\.\+\-\[\]\{\}\(\)\\])/g,"\\$1")}var m=!0,l=e[0],k=l.elements,o,u,z,s,q,
|
||||
p,A,r,x,y;k.ruleset?o=l.elements.ruleset.value:k._filter&&(o=l.elements._filter.value);if(!o)return!0;a.isFunction(i[o])&&(z=i[o]);o=a.extend({},g[o.toLowerCase()]||{},j);s=[];p=0;for(r=l.elements.length;p<r;p++)m=k[p],(q=m.name)&&k[q]&&(!k[q].length||k[q][0]===m)&&s.push(q);s=s.join("\n");u={};for(q in o)if(o.hasOwnProperty(q)&&(m=[],"^"==q.substr(0,1))){(m=s.match(RegExp("^"+n(q.substr(1))+".*$","gm")))||(m=[]);p=0;for(r=m.length;p<r;p++)u[m[p]]=o[q];o[q]=null;delete o[q]}o=a.extend(o,u);for(q in o)if(o.hasOwnProperty(q)&&
|
||||
(f=o[q],(m=k[q])||(m=k[q+"[]"]),s=m?a.trim(b(a(m))):"",u=(f.modifier||"")+",",m&&!m.disabled)){if(f["if"]){a.isArray(f["if"])||(f["if"]=[f["if"]]);for(p=0;p<f["if"].length;p++)r=f["if"][p],m=new Function("el","return !!("+r.test.replace(/\$(\w+)/g,"(jQuery('[name=$1]').is(':radio, :checkbox') ? jQuery('[name=$1]:checked').val() : jQuery('[name=$1]').val())")+")"),m(k)?f[r.attr]=r.value:delete f[r.attr]}if(s){m=parseInt(f.minlength)||0;r=parseInt(f.maxlength)||0;y=/b$/.test(f.minlength||"");x=/b$/.test(f.maxlength||
|
||||
"");p=s.length;if(y||x)A=d(s);if(m&&m>(y?A:p)||r&&r<(x?A:p))return this.cast("ALERT",[l,q,"outofrange",m,r])&&!1;if(f.equalto&&(r=(p=k[f.equalto])?a.trim(b(a(p))):"",p&&r!==s))return this.cast("ALERT",[l,q,"equalto"])&&!1;x=(f.rule||"").split(",");p=0;for(r=x.length;p<r;p++)if(y=x[p])if(m=this.cast("APPLY_RULE",[y,s]),-1<u.indexOf("not,")&&(m=!m),!m)return this.cast("ALERT",[l,q,"invalid_"+y])&&!1}else if(f["default"]&&(s=f["default"]),f.required)return this.cast("ALERT",[l,q,"isnull"])&&!1}return a.isFunction(z)?
|
||||
z(l):!0},API_ADD_RULE:function(a,b){var c=b[0].toLowerCase();e[c]=b[1]},API_DEL_RULE:function(a,b){var c=b[0].toLowerCase();delete e[c]},API_GET_RULE:function(a,b){var c=b[0].toLowerCase();return e[c]?e[c]:null},API_ADD_FILTER:function(a,b){var c=b[0].toLowerCase();g[c]=b[1]},API_DEL_FILTER:function(a,b){var c=b[0].toLowerCase();delete g[c]},API_GET_FILTER:function(a,b){var c=b[0].toLowerCase();return g[c]?g[c]:null},API_ADD_EXTRA_FIELD:function(a,b){var c=b[0].toLowerCase();j[c]=b[1]},API_GET_EXTRA_FIELD:function(a,
|
||||
b){var c=b[0].toLowerCase();return j[c]},API_DEL_EXTRA_FIELD:function(a,b){var c=b[0].toLowerCase();delete j[c]},API_APPLY_RULE:function(b,c){var d=c[0],g=c[1];return"undefined"==typeof e[d]?!0:a.isFunction(e[d])?e[d](g):e[d]instanceof RegExp?e[d].test(g):a.isArray(e[d])?-1<a.inArray(g,e[d]):!0},API_ALERT:function(b,c){var d=c[0],e=c[1],g=c[2],i=c[3],k=c[4],l=this.cast("GET_MESSAGE",[e]),j=this.cast("GET_MESSAGE",[g]);j!=g&&(j=0>j.indexOf("%s")?l+j:j.replace("%s",l));if(i||k)j+="("+(i||"")+"~"+(k||
|
||||
"")+")";this.cast("SHOW_ALERT",[j]);a(d.elements[e]).focus()},API_SHOW_ALERT:function(a,b){alert(b[0])},API_ADD_MESSAGE:function(a,b){c[b[0]]=b[1]},API_GET_MESSAGE:function(a,b){var d=b[0];return c[d]||d},API_ADD_CALLBACK:function(a,b){i[b[0]]=b[1]},API_REMOVE_CALLBACK:function(a,b){delete i[b[0]]}}));xe.registerApp(k);var l=xe.createPlugin("editor_stub",{API_BEFORE_VALIDATE:function(a,b){var c=b[0].getAttribute("editor_sequence");c&&"object"==typeof c&&(c=c.value);if(c)try{editorRelKeys[c].content.value=
|
||||
editorRelKeys[c].func(c)||""}catch(d){}}});k.registerPlugin(new l)})(jQuery);function filterAlertMessage(a){var b=a.message,d=a.act,a=a.redirect_url,c=location.href;"undefined"!=typeof b&&b&&"success"!=b&&alert(b);"undefined"!=typeof d&&d?c=current_url.setQuery("act",d):"undefined"!=typeof a&&a&&(c=a);c==location.href&&(c=c.replace(/#(.*)$/,""));location.href=c}function procFilter(a,b){b(a);return!1}
|
||||
function legacy_filter(a,b,d,c,e,g,i,j){var k=xe.getApp("Validator")[0],l=jQuery,h=[];if(!k)return!1;b.elements._filter||l(b).prepend('<input type="hidden" name="_filter" />');b.elements._filter.value=a;h[0]=a;h[1]=function(a){var h={},a=l(a).serializeArray();l.each(a,function(a,b){var c=l.trim(b.value),d=b.name;if(!c||!d)return!0;j[d]&&(d=j[d]);/\[\]$/.test(d)&&(d=d.replace(/\[\]$/,""));h[d]=h[d]?h[d]+("|@|"+c):b.value});if(i&&!confirm(i))return!1;exec_xml(d,c,h,e,g,h,b)};k.cast("ADD_CALLBACK",h);
|
||||
k.cast("VALIDATE",[b,a]);return!1};
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ var Validator = xe.createApp('Validator', {
|
|||
API_VALIDATE : function(sender, params) {
|
||||
var result = true, form = params[0], elems = form.elements, filter, filter_to_add, ruleset, callback;
|
||||
var fields, names, name, el, val, mod, len, lenb, max, min, maxb, minb, rules, e_el, e_val, i, c, r, if_, fn;
|
||||
|
||||
if(elems['ruleset']) filter = form.elements['ruleset'].value;
|
||||
else if(elems['_filter']) filter = form.elements['_filter'].value;
|
||||
if(!filter) return true;
|
||||
|
|
@ -156,8 +155,11 @@ var Validator = xe.createApp('Validator', {
|
|||
if(!$.isArray(f['if'])) f['if'] = [f['if']];
|
||||
for(i=0;i<f['if'].length;i++) {
|
||||
if_ = f['if'][i];
|
||||
fn = new Function('el', 'return !!(' + (if_.test.replace(/\$(\w+)/g, 'el["$1"].value')) +')');
|
||||
fn = new Function('el', 'return !!(' + (if_.test.replace(/\$(\w+)/g, '(jQuery(\'[name=$1]\').is(\':radio, :checkbox\') ? jQuery(\'[name=$1]:checked\').val() : jQuery(\'[name=$1]\').val())')) +')');
|
||||
//fn = new Function('el', 'return !!(' + (if_.test.replace(/\$(\w+)/g, 'el["$1"].value')) +')');
|
||||
if(fn(elems)) f[if_.attr] = if_.value;
|
||||
else delete f[if_.attr];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue