我正在使用理想形式来创建我的验证表单。
JS 包含“谢谢”“未发送信息”等信息。
下面是包含此信息的脚本,我想将其删除,以便它加载我创建的页面,上面写着谢谢......或失败......
谁能告诉我要删除哪些行才能使其正常工作?
我已经使用 php 设置了我的表单以自动重定向到相关页面,但是我正在努力将提交按钮设置为默认设置,因为脚本会覆盖 php 函数。
(function(e,t,n,r){"use strict";e.idealforms={},e.idealforms.filters={},e.idealforms.errors={},e.idealforms.flags={},e.idealforms.ajaxRequests={};var i={getMaxWidth:function(t){var n=0;return t.each(function(){var t=e(this).outerWidth();t>n&&(n=t)}),n},getLessVar:function(t,n){var r=e('<p class="'+t+'"></p>').hide().appendTo("body").css(n);return e("."+t).remove(),/^\d+/.test(r)?parseInt(r,10):r},getKeys:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},getObjSize:function(e){var t=0,n;for(n in e)e.hasOwnProperty(n)&&t++;return t},isFunction:function(e){return typeof e=="function"},isRegex:function(e){return e instanceof RegExp},isString:function(e){return typeof e=="string"},getByNameOrId:function(t){var n=e('[name="'+t+'"]').length?e('[name="'+t+'"]'):e("#"+t);return n.length?n:e.error('The field "'+t+"\" doesn't exist.")},getFieldsFromArray:function(t){var n=[];for(var r=0,s=t.length;r<s;r++)n.push(i.getByNameOrId(t[r]).get(0));return e(n)},convertToArray:function(e){return Object.prototype.toString.call(e)==="[object Array]"?e:[e]},getIdealType:function(e){var t=e.attr("type")||e[0].tagName.toLowerCase();return/(text|password|email|number|search|url|tel|textarea)/.test(t)&&"text"||/file/.test(t)&&"file"||/select/.test(t)&&"select"||/(radio|checkbox)/.test(t)&&"radiocheck"||/(button|submit|reset)/.test(t)&&"button"||/h\d/.test(t)&&"heading"||/hr/.test(t)&&"separator"||/hidden/.test(t)&&"hidden"},makeInput:function(e,t,n,r,i){function l(e){var t,n,r;return/:/.test(e)?(r=e.split(":"),t=r[0],n=r[1]):t=n=e,{item:t,value:n}}var s,o=[],u,a,f;/^(text|password|email|number|search|url|tel|file|hidden)$/.test(n)&&(s='<input type="'+n+'" '+'id="'+e+'" '+'name="'+e+'" '+'value="'+t+'" '+(i&&'placeholder="'+i+'"')+"/>"),/textarea/.test(n)&&(s='<textarea id="'+e+'" name="'+e+'" value="'+t+'"></textarea>');if(/select/.test(n)){o=[];for(a=0,f=r.length;a<f;a++)u=l(r[a]).item,t=l(r[a]).value,o.push('<option value="'+t+'">'+u+"</option>");s='<select id="'+e+'" name="'+e+'">'+o.join("")+"</select>"}if(/(radio|checkbox)/.test(n)){o=[];for(a=0,f=r.length;a<f;a++)u=l(r[a]).item,t=l(r[a]).value,o.push('<label><input type="'+n+'" name="'+e+'" value="'+t+'" />'+u+"</label>");s=o.join("")}return s}};e.fn.idealTabs=function(t){var n=this,r=t,s=e('<ul class="ideal-tabs-wrap"/>'),o=function(){var t=[];return n.each(function(){var n=e(this).attr("name"),r='<li class="ideal-tabs-tab"><span>'+n+"</span>"+'<i class="ideal-tabs-tab-counter ideal-tabs-tab-counter-zero">0</i>'+"</li>";t.push(r)}),e(t.join(""))}(),u={getCurIdx:function(){return o.filter(".ideal-tabs-tab-active").index()},getTabIdxByName:function(t){var n=new RegExp(t,"i"),r=o.filter(function(){return n.test(e(this).text())});return r.index()}},a={switchTab:function(e){var t=i.isString(e)?u.getTabIdxByName(e):e;o.removeClass("ideal-tabs-tab-active"),o.eq(t).addClass("ideal-tabs-tab-active"),n.hide().eq(t).show()},nextTab:function(){var e=u.getCurIdx()+1;e>o.length-1?a.firstTab():a.switchTab(e)},prevTab:function(){a.switchTab(u.getCurIdx()-1)},firstTab:function(){a.switchTab(0)},lastTab:function(){a.switchTab(o.length-1)},updateCounter:function(e,t){var n=isNaN(e)?u.getTabIdxByName(name):e,r=o.eq(n).find(".ideal-tabs-tab-counter");r.removeClass("ideal-tabs-tab-counter-zero"),t||r.addClass("ideal-tabs-tab-counter-zero"),r.html(t)}};for(var f in a)n[f]=a[f];return o.first().addClass("ideal-tabs-tab-active").end().click(function(){var t=e(this).text();n.switchTab(t)}),s.append(o).appendTo(r),n.addClass("ideal-tabs-content"),n.each(function(){var t=e(this),n=e(this).attr("name");t.data("ideal-tabs-content-name",n).removeAttr("name")}),n.hide().first().show(),n},e.fn.idealSelect=function(){return this.each(function(){var t=e(this),r=t.find("option"),s=function(){var n=e('<ul class="ideal-select '+t.attr("name")+'"/>'),i=e('<li><span class="ideal-select-title">'+r.filter(":selected").text()+"</span></li>"),s=function(){var t=[];return r.each(function(){var n=e(this);t.push('<li class="ideal-select-item">'+n.text()+"</li>")}),t}();return i.append('<ul class="ideal-select-sub">'+s.join("")+"</ul>"),n.append(i),{select:n,title:i.find(".ideal-select-title"),sub:i.find(".ideal-select-sub"),items:i.find(".ideal-select-item")}}(),o={getSelectedIdx:function(){return s.items.filter(".ideal-select-item-selected").index()},init:function(){t.css({position:"absolute",left:"-9999px"}),s.sub.hide(),s.select.insertAfter(t),s.select.css("min-width",i.getMaxWidth(s.items)),s.items.eq(r.filter(":selected").index()).addClass("ideal-select-item-selected")}(),noWindowScroll:function(e){(e.which===40||e.which===38||e.which===13)&&e.preventDefault()},focusHack:function(){setTimeout(function(){t.trigger("focus")},1)},focus:function(){s.select.addClass("ideal-select-focus"),e(n).on("keydown.noscroll",o.noWindowScroll)},blur:function(){s.select.removeClass("ideal-select-open ideal-select-focus"),e(n).off(".noscroll")},scrollIntoView:function(e){var t=s.items.filter(".ideal-select-item-selected"),n=s.items.outerHeight(),r=s.sub.outerHeight(),i=function(){var i=t.position().top+n;return e==="down"?i<=r:i>0}();i||(n=e==="down"?n:-n,s.sub.scrollTop(s.sub.scrollTop()+n))},scrollToItem:function(){var e=o.getSelectedIdx(),t=s.items.outerHeight(),n=s.items.length,r=t*n,i=t*(n-e);s.sub.scrollTop(r-i)},showMenu:function(){s.sub.fadeIn("fast"),s.select.addClass("ideal-select-open"),o.select(o.getSelectedIdx()),o.scrollToItem()},hideMenu:function(){s.sub.hide(),s.select.removeClass("ideal-select-open")},select:function(e){s.items.removeClass("ideal-select-item-selected"),s.items.eq(e).addClass("ideal-select-item-selected")},change:function(e){var n=s.items.eq(e).text();o.select(e),s.title.text(n),r.eq(e).prop("selected",!0),t.trigger("change")},keydown:function(t){var n=o.getSelectedIdx(),i=s.select.is(".ideal-select-menu"),u=s.select.is(".ideal-select-open"),a={9:function(){i&&(o.blur(),o.hideMenu())},13:function(){i&&(u?o.hideMenu():o.showMenu()),o.change(n)},27:function(){i&&o.hideMenu()},40:function(){n<r.length-1&&(u?o.select(n+1):o.change(n+1)),o.scrollIntoView("down")},38:function(){n>0&&(u?o.select(n-1):o.change(n-1)),o.scrollIntoView("up")},"default":function(){var n=String.fromCharCode(t),r=s.items.filter(function(){return/^\w+$/i.test(n)&&(new RegExp("^"+n,"i")).test(e(this).text())}),i=r.length,a=s.select.data("counter")+1||0,f=s.select.data("key")||t,l=r.eq(a).index();if(!i)return!1;f===t?a<i?s.select.data("counter",a):(s.select.data("counter",0),l=r.eq(0).index()):(s.select.data("counter",0),l=r.eq(0).index()),u?o.select(l):o.change(l),s.select.data("key",t),o.scrollToItem(),o.focusHack()}};a[t]?a[t]():a["default"]()}},u={focus:o.focus,"blur.menu":function(){o.blur(),o.hideMenu()},"blur.list":function(){o.blur()},keydown:function(e){o.keydown(e.which)},"clickItem.menu":function(){o.change(e(this).index()),o.hideMenu()},"clickItem.list":function(){o.change(e(this).index())},"clickTitle.menu":function(){o.focus(),o.showMenu(),t.trigger("focus")},"hideOutside.menu":function(){t.off("blur.menu"),e(n).on("mousedown.ideal",function(r){e(r.target).closest(s.select).length?o.focusHack():(e(n).off("mousedown.ideal"),t.on("blur.menu",u["blur.menu"]))})},"mousedown.list":function(){o.focusHack()}},a=function(){s.select.removeClass("ideal-select-menu ideal-select-list"),t.off(".menu .list"),s.items.off(".menu .list"),s.select.off(".menu .list"),s.title.off(".menu .list")};s.select.on("menu",function(){a(),s.select.addClass("ideal-select-menu"),o.hideMenu(),t.on({"blur.menu":u["blur.menu"],"focus.menu":u.focus,"keydown.menu":u.keydown}),s.select.on("mousedown.menu",u["hideOutside.menu"]),s.items.on("click.menu",u["clickItem.menu"]),s.title.on("click.menu",u["clickTitle.menu"])}),s.select.on("list",function(){a(),s.select.addClass("ideal-select-list"),o.showMenu(),t.on({"blur.list":u["blur.list"],"focus.list":u.focus,"keydown.list":u.keydown}),s.select.on("mousedown.list",u["mousedown.list"]),s.items.on("mousedown.list",u["clickItem.list"])}),t.keydown(function(e){e.which!==9&&e.preventDefault()}),s.select.on("reset",function(){o.change(0)}),s.select.trigger("menu")})},e.fn.idealRadioCheck=function(){return this.each(function(){var t=e(this),n=e("<span/>");n.addClass("ideal-"+(t.is(":checkbox")?"check":"radio")),t.is(":checked")&&n.addClass("checked"),n.insertAfter(t),t.parent("label").addClass("ideal-radiocheck-label").attr("onclick",""),t.css({position:"absolute",left:"-9999px"}),t.on({change:function(){var t=e(this);t.is('input[type="radio"]')&&t.parent().siblings("label").find(".ideal-radio").removeClass("checked"),n.toggleClass("checked",t.is(":checked"))},focus:function(){n.addClass("focus")},blur:function(){n.removeClass("focus")},click:function(){e(this).trigger("focus")}})})},function(e){var t=typeof e("<input/>")[0].multiple!="undefined",n=/msie/i.test(navigator.userAgent);e.fn.idealFile=function(){return this.each(function(){var r=e(this).addClass("ideal-file"),i=e('<div class="ideal-file-wrap">'),s=e('<input type="text" class="ideal-file-filename" />'),o=e('<button type="button" class="ideal-file-upload">Open</button>'),u=e('<label class="ideal-file-upload" for="'+r[0].id+'">Open</label>');r.css({position:"absolute",left:"-9999px"}),i.append(s,n?u:o).insertAfter(r),r.attr("tabIndex",-1),o.attr("tabIndex",-1),o.click(function(){r.focus().click()}),r.change(function(){var e=[],n,i;if(t){n=r[0].files;for(var o=0,u=n.length;o<u;o++)e.push(n[o].name);i=e.join(", ")}else i=r.val().split("\\").pop();s.val(i).attr("title",i)}),s.on({focus:function(){r.trigger("change")},blur:function(){r.trigger("blur")},keydown:function(e){if(e.which===13)n||r.trigger("click");else{if(e.which!==8&&e.which!==46){if(e.which===9)return;return!1}r.replaceWith(r=r.val("").clone(!0)),r.trigger("change"),s.val("")}}})})}}(jQuery),e.idealforms.errors={required:"This field is required.",number:"Must be a number.",digits:"Must be only digits.",name:"Must be at least 3 characters long, and must only contain letters.",username:"Must be at between 4 and 32 characters long and start with a letter. You may use letters, numbers, underscores, and one dot (.)",pass:"Must be at least 6 characters long, and contain at least one number, one uppercase and one lowercase letter.",strongpass:"Must be at least 8 characters long and contain at least one uppercase and one lowercase letter and one number or special character.",email:"Must be a valid e-mail address. <em>(e.g. user@gmail.com)</em>",phone:"Must be a valid US phone number. <em>(e.g. 555-123-4567)</em>",zip:"Must be a valid US zip code. <em>(e.g. 33245 or 33245-0003)</em>",url:"Must be a valid URL. <em>(e.g. www.google.com)</em>",minChar:"Must be at least <strong>{0}</strong> characters long.",minOption:"Check at least <strong>{0}</strong> options.",maxChar:"No more than <strong>{0}</strong> characters long.",maxOption:"No more than <strong>{0}</strong> options allowed.",range:"Must be a number between {0} and {1}.",date:"Must be a valid date. <em>(e.g. {0})</em>",dob:"Must be a valid date of birth.",exclude:'"{0}" is not available.',excludeOption:"{0}",equalto:'Must be the same value as <strong>"{0}"</strong>',extension:'File(s) must have a valid extension. <em>(e.g. "{0}")</em>',ajaxSuccess:"<strong>{0}</strong> is not available.",ajaxError:"Server error..."};var s=function(){var t={required:{regex:/.+/,error:e.idealforms.errors.required},number:{regex:function(e,t){return!isNaN(t)},error:e.idealforms.errors.number},digits:{regex:/^\d+$/,error:e.idealforms.errors.digits},name:{regex:/^[A-Za-z]{3,}$/,error:e.idealforms.errors.name},username:{regex:/^[a-z](?=[\w.]{3,31}$)\w*\.?\w*$/i,error:e.idealforms.errors.username},pass:{regex:/(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}/,error:e.idealforms.errors.pass},strongpass:{regex:/(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,error:e.idealforms.errors.strongpass},email:{regex:/[^@]+@[^@]/,error:e.idealforms.errors.email},phone:{regex:/^[2-9]\d{2}-\d{3}-\d{4}$/,error:e.idealforms.errors.phone},zip:{regex:/^\d{5}$|^\d{5}-\d{4}$/,error:e.idealforms.errors.zip},url:{regex:/^(?:(ftp|http|https):\/\/)?(?:[\w\-]+\.)+[a-z]{2,6}([\:\/?#].*)?$/i,error:e.idealforms.errors.url},min:{regex:function(t,n){var r=t.input,i=t.userOptions.data.min,s=r.is('[type="checkbox"], [type="radio"]');return s?(this.error=e.idealforms.errors.minOption.replace("{0}",i),r.filter(":checked").length>=i):(this.error=e.idealforms.errors.minChar.replace("{0}",i),n.length>=i)}},max:{regex:function(t,n){var r=t.input,i=t.userOptions.data.max,s=r.is('[type="checkbox"], [type="radio"]');return s?(this.error=e.idealforms.errors.maxOption.replace("{0}",i),r.filter(":checked").length<=i):(this.error=e.idealforms.errors.maxChar.replace("{0}",i),n.length<=i)}},range:{regex:function(t,n){var r=t.userOptions.data.range,i=+n;return this.error=e.idealforms.errors.range.replace("{0}",r[0]).replace("{1}",r[1]),i>=r[0]&&i<=r[1]}},date:{regex:function(t,n){var r=t.userOptions.data&&t.userOptions.data.date?t.userOptions.data.date:"mm/dd/yyyy",i=/[^mdy]/.exec(r)[0],s=r.split(i),o=n.split(i),u=function(e,t){var n,r,i;for(var s=0,o=t.length;s<o;s++)/m/.test(t[s])&&(n=e[s]),/d/.test(t[s])&&(r=e[s]),/y/.test(t[s])&&(i=e[s]);return n>0&&n<13&&i&&i.length===4&&r>0&&r<=(new Date(i,n,0)).getDate()};return this.error=e.idealforms.errors.date.replace("{0}",r),u(o,s)}},dob:{regex:function(n,r){var i=n.userOptions.data&&n.userOptions.data.dob?n.userOptions.data.dob:"mm/dd/yyyy",s={input:n.input,userOptions:{data:{date:i}}},o=t.date.regex(s,r),u=/\d{4}/.exec(r),a=(new Date).getFullYear(),f=a-100;return this.error=e.idealforms.errors.dob,o&&u>=f&&u<=a}},exclude:{regex:function(t,n){var r=t.input,i=t.userOptions.data.exclude,s=r.is('[type="checkbox"], [type="radio"], select');return this.error=s?e.idealforms.errors.excludeOption.replace("{0}",n):this.error=e.idealforms.errors.exclude.replace("{0}",n),e.inArray(n,i)===-1}},equalto:{regex:function(t,n){var r=e(t.userOptions.data.equalto),i=t.input,s=r.attr("name")||r.attr("id"),o=r.parents(".ideal-field").filter(function(){return e(this).data("ideal-isvalid")===!0}).length;return o?(this.error=e.idealforms.errors.equalto.replace("{0}",s),i.val()===r.val()):!1}},extension:{regex:function(t,n){var r=t.input[0].files||[{name:n}],i=t.userOptions.data.extension,s=new RegExp("\\."+i.join("|")+"$","i"),o=!1;for(var u=0,a=r.length;u<a;u++)o=s.test(r[u].name);return this.error=e.idealforms.errors.extension.replace("{0}",i.join('", "')),o}},ajax:{regex:function(t,n,r){var i=this,s=t.input,o=t.userOptions,u=s.attr("name"),a=s.parents(".ideal-field"),f=!1,l=o.errors&&o.errors.ajax;i.error={},i.error.success=l&&l.success?l.success:e.idealforms.errors.ajaxSuccess.replace("{0}",n),i.error.fail=l&&l.error?l.error:e.idealforms.errors.ajaxError;var c={};c[u]=e.trim(n);var h=t.userOptions.data.ajax,p={type:"post",dataType:"json",data:c,success:function(e,t,n){console.log(e),r(i.error.success,!0),s.data({"ideal-ajax-resp":e,"ideal-ajax-error":i.error.success}),s.trigger("change"),a.removeClass("ajax"),h._success&&h._success(e,t,n)},error:function(e,t,n){t!=="abort"&&(r(i.error.fail,!1),s.data("ideal-ajax-error",i.error.fail),a.removeClass("ajax"),h._error&&h._error(e,t,n))}};e.extend(p,h),s.removeData("ideal-ajax-error"),s.removeData("ideal-ajax-resp"),a.addClass("ajax"),e.idealforms.ajaxRequests[u]=e.ajax(p)}}};return t},o={inputs:{},customFilters:{},customFlags:{},globalFlags:"",onSuccess:function(e){alert("Thank you...")},onFail:function(){alert("Invalid!")},responsiveAt:"auto",disableCustom:""},u=function(t,n){var r=this;r.$form=e(t),r.opts=e.extend({},o,n),r.$tabs=r.$form.find("section"),e.extend(e.idealforms.filters,s()),r._init()};e.fn.idealforms=function(t){return this.each(function(){e.data(this,"idealforms")||e.data(this,"idealforms",new u(this,t))})};var a={fieldWidth:i.getLessVar("ideal-field-width","width")};e.extend(u.prototype,{_init:function(){var n=this,r=n.opts,i=n._getFormElements();n.$form.css("visibility","visible").addClass("ideal-form").attr("novalidate","novalidate"),i.inputs.add(i.headings).add(i.separators).each(function(){n._doMarkup(e(this))});if(n.$tabs.length){var s=e('<div class="ideal-wrap ideal-tabs ideal-full-width"/>');n.$form.prepend(s),n.$tabs.idealTabs(s)}jQuery.ui&&(e.datepicker._checkOffset=function(e,t,n){return t}),n.$form.find("[data-ideal]").each(function(){var t=r.inputs[this.name];r.inputs[this.name]=t||{filters:e(this).data("ideal")}}),r.responsiveAt&&(e(t).resize(function(){n._responsive()}),n._responsive()),n.$form.on({keydown:function(e){e.which===13&&e.target.nodeName!=="TEXTAREA"&&e.preventDefault()},submit:function(e){n.isValid()?r.onSuccess(e):(e.preventDefault(),r.onFail(),n.focusFirstInvalid())}}),n._adjust(),n._attachEvents(),n.fresh()},_getFormElements:function(){return{inputs:this.$form.find("input, select, textarea, :button"),labels:this.$form.find("div > label:first-child"),text:this.$form.find('input:not([type="checkbox"], [type="radio"], [type="submit"]), textarea'),select:this.$form.find("select"),radiocheck:this.$form.find('input[type="radio"], input[type="checkbox"]'),buttons:this.$form.find(":button"),file:this.$form.find('input[type="file"]'),headings:this.$form.find("h1, h2, h3, h4, h5, h6"),separators:this.$form.find("hr"),hidden:this.$form.find("input:hidden")}},_getUserInputs:function(){return this.$form.find('[name="'+i.getKeys(this.opts.inputs).join('"], [name="')+'"]')},_getTab:function(t){var n=this,r=!isNaN(t);return r?n.$tabs.eq(t):n.$tabs.filter(function(){var n=new RegExp(t,"i");return n.test(e(this).data("ideal-tabs-content-name"))})},_getCurrentTabIdx:function(){return this.$tabs.index(this.$form.find(".ideal-tabs-content:visible"))},_updateTabsCounter:function(){var e=this;e.$tabs.each(function(t){var n=e.getInvalidInTab(t).length;e.$tabs.updateCounter(t,n)})},_adjust:function(){var t=this,n=t.opts,r=t._getFormElements(),s=t._getCurrentTabIdx();r.inputs.attr("autocomplete","off"),t.$tabs.length&&t.$tabs.show();var o=r.labels;o.removeAttr("style").width(i.getMaxWidth(o)),t.$tabs.length?this.$tabs.each(function(){e(this).find(".ideal-heading:first").addClass("first-child")}):t.$form.find(".ideal-heading:first").addClass("first-child"),t._setDatepicker(),t.$tabs.length&&(t.$tabs.hide(),t.switchTab(s))},_setDatepicker:function(){var t=this.opts,n=this.$form.find("input.datepicker");jQuery.ui&&n.length&&(n.each(function(){var n=t.inputs[this.name],r=n&&n.data&&n.data.date,i=r?r.replace("yyyy","yy"):"mm/dd/yy";e(this).datepicker({dateFormat:i,beforeShow:function(t){e(t).addClass("open")},onChangeMonthYear:function(){var t=e(this),n=t.outerWidth();setTimeout(function(){t.datepicker("widget").css("width",n)},1)},onClose:function(){e(this).removeClass("open")}})}),n.on("focus keyup",function(){var t=e(this),n=t.outerWidth();t.datepicker("widget").css("width",n)}),n.parent().siblings(".ideal-error").addClass("hidden"))},_doMarkup:function(t){var n=this.opts,r=i.getIdealType(t),s=e('<span class="ideal-field"/>'),o=e('<span class="ideal-error" />'),u=e('<i class="ideal-icon ideal-icon-valid" />'),a=e('<i class="ideal-icon ideal-icon-invalid"/>').click(function(){e(this).parent().find("input:first, textarea, select").focus()});t.closest("div").addClass("ideal-wrap").children("label:first-child").addClass("ideal-label");var f={_defaultInput:function(){t.wrapAll(s).after(u,a).parent().after(o)},text:function(){f._defaultInput()},radiocheck:function(){var e=t.parents(".ideal-field").length;e||(t.parent().nextAll().andSelf().wrapAll(s.addClass("ideal-radiocheck")),t.parents(".ideal-field").append(u,a).after(o)),/radiocheck/.test(n.disableCustom)||t.idealRadioCheck()},select:function(){f._defaultInput(),/select/.test(n.disableCustom)||t.idealSelect()},file:function(){f._defaultInput(),/file/.test(n.disableCustom)||t.idealFile()},button:function(){/button/.test(n.disableCustom)||t.addClass("ideal-button")},hidden:function(){t.closest("div").addClass("ideal-hidden")},heading:function(){t.closest("div").addClass("ideal-full-width"),t.parent().children().wrapAll('<span class="ideal-heading"/>')},separator:function(){t.closest("div").addClass("ideal-full-width"),t.wrapAll('<div class="ideal-separator"/>')}};f[r]?f[r]():e.noop(),o.add(u).add(a).hide()},_validate:function(t,n){function g(){p.removeClass("valid invalid").removeData("ideal-isvalid"),d.add(v).add(m).hide()}function y(e,t){g(),t?m.show():v.show(),p.addClass(t?"valid":"invalid"),p.data("ideal-isvalid",t),t||d.html(e).toggle(p.is(".ideal-field-focus"))}var r=this,s=this.opts,o=s.inputs[t.attr("name")],u=o.filters&&o.filters.split(/\s/),a=t.attr("name"),f=t.val(),l=e.idealforms.ajaxRequests[a],c=t.is('[type="checkbox"], [type="radio"]'),h={input:c?r.$form.find('[name="'+a+'"]'):t,userOptions:o},p=t.parents(".ideal-field"),d=p.siblings(".ideal-error"),v=c?t.parent().siblings(".ideal-icon-invalid"):t.siblings(".ideal-icon-invalid"),m=c?t.parent().siblings(".ideal-icon-valid"):t.siblings(".ideal-icon-valid"),b=t.data("ideal-value")||0;t.data("ideal-value",f);if(n.type==="keyup"&&f===b)return!1;u?e.each(u,function(r,s){var u=e.idealforms.filters[s],a=o.errors&&o.errors[s],c="";if(!f&&s!=="required")return g(),!1;if(u){n.type==="keyup"&&l&&(l.abort(),p.removeClass("ajax"));if(s==="ajax"){y(c,!1),d.hide();if(n.type==="keyup")u.regex(h,f,y);else{var v=t.data("ideal-ajax-error");v&&y(v,t.data("ideal-ajax-resp")||!1)}}else{var m=i.isRegex(u.regex)&&u.regex.test(f)||i.isFunction(u.regex)&&u.regex(h,f);c=a||u.error,y(c,m);if(!m)return!1}}}):g();var w=function(){var t=o.flags&&o.flags.split(" ")||[];return s.globalFlags&&e.each(s.globalFlags.split(),function(e,n){t.push(n)}),t}();w.length&&e.each(w,function(r,i){var s=e.idealforms.flags[i];s&&s(t,n.type)}),r.$tabs.length&&r._updateTabsCounter(r._getCurrentTabIdx())},_attachEvents:function(){var t=this;t._getUserInputs().on("keyup change focus blur",function(n){var r=e(this),i=r.parents(".ideal-field"),s=r.is("input[type=file]");(n.type==="focus"||s&&n.type==="change")&&i.addClass("ideal-field-focus"),n.type==="blur"&&i.removeClass("ideal-field-focus"),t._validate(r,n)})},_responsive:function(){var n=this._getFormElements(),r=a.fieldWidth+n.labels.outerWidth(),i=n.labels.filter(function(){return e(this).html()===" "}),s=this.$form.find(".ideal-select");this.opts.responsiveAt==="auto"?this.$form.toggleClass("stack",this.$form.width()<r):this.$form.toggleClass("stack",e(t).width()<this.opts.responsiveAt);var o=this.$form.is(".stack");i.toggle(!o),s.trigger(o?"list":"menu");var u=this.$form.find("input.hasDatepicker");u.length&&u.datepicker("hide")}}),e.extend(u.prototype,{getInvalid:function(){return this.$form.find(".ideal-field").filter(function(){return e(this).data("ideal-isvalid")===!1})},getInvalidInTab:function(t){return this._getTab(t).find(".ideal-field").filter(function(){return e(this).data("ideal-isvalid")===!1})},isValid:function(){return!this.getInvalid().length},isValidField:function(e){var t=i.getByNameOrId(e);return t.parents(".ideal-field").data("ideal-isvalid")===!0},focusFirst:function(){return this.$tabs.length?this.$tabs.filter(":visible").find(".ideal-field:first").find("input:first, select, textarea").focus():this.$form.find(".ideal-field:first").find("input:first, select, textarea").focus(),this},focusFirstInvalid:function(){var e=this.getInvalid().first().find("input:first, select, textarea"),t=e.parents(".ideal-tabs-content").data("ideal-tabs-content-name");return this.$tabs.length&&this.switchTab(t),e.focus(),this},switchTab:function(e){return this.$tabs.switchTab(e),this},nextTab:function(){return this.$tabs.nextTab(),this},prevTab:function(){return this.$tabs.prevTab(),this},firstTab:function(){return this.$tabs.firstTab(),this},lastTab:function(){return this.$tabs.lastTab(),this},fresh:function(){return this._getUserInputs().change().parents(".ideal-field").removeClass("valid invalid"),this},freshFields:function(t){return t=i.convertToArray(t),e.each(t,function(e){var n=i.getByNameOrId(t[e]);n.change().parents(".ideal-field").removeClass("valid invalid")}),this},reload:function(){return this._adjust(),this._attachEvents(),this},reset:function(){var e=this._getFormElements();return e.text.val(""),e.radiocheck.removeAttr("checked"),e.select.find("option").first().prop("selected",!0),this.$form.find(".ideal-select").trigger("reset"),this.$tabs.length&&this.firstTab(),this.focusFirst().fresh(),this},resetFields:function(t){t=i.convertToArray(t);var n=this._getFormElements();return e.each(t,function(e,t){var n=i.getByNameOrId(t),r=i.getIdealType(n);(r==="text"||r==="file")&&n.val(""),r==="radiocheck"&&n.removeAttr("checked"),r==="select"&&(n.find("option").first().prop("selected",!0),n.next(".ideal-select").trigger("reset")),n.change()}),this.freshFields(t),this},toggleFields:function(t){t=i.convertToArray(t);var n=this,r=i.getFieldsFromArray(t);return r.each(function(){var t=e(this),r=t.attr("name")||t.attr("id"),i=n.opts.inputs[r],s=i&&i.filters,o=t.data("ideal-filters")||"";t.data("ideal-filters",s),t.closest(".ideal-wrap").toggle(),n.setFieldOptions(r,{filters:o})}),this},setOptions:function(t){return e.extend(!0,this.opts,t),this.reload().fresh(),this},setFieldOptions:function(t,n){return e.extend(!0,this.opts.inputs[t],n),this.reload().freshFields([t]),this},addFields:function(t){function s(t){var s=t.name,o={filters:t.filters||"",data:t.data||{},errors:t.errors||{},flags:t.flags||""},u=t.label||"",a=t.type,f=t.list||[],l=t.placeholder||"",c=t.value||"",h=e("<div><label>"+u+":</label>"+i.makeInput(s,c,a,f,l)+"</div>"),p=h.find("input, select, textarea, :button");o.filters&&(n.opts.inputs[s]=o),n._doMarkup(p),t.addAfter?h.insertAfter(e(i.getByNameOrId(t.addAfter)).parents(".ideal-wrap")):t.addBefore?h.insertBefore(e(i.getByNameOrId(t.addBefore)).parents(".ideal-wrap")):t.appendToTab?h.insertAfter(n._getTab(t.appendToTab).find(".ideal-wrap:last-child")):h.insertAfter(n.$form.find(".ideal-wrap").last()),r.push(s)}t=i.convertToArray(t);var n=this,r=[];return e.each(t,function(e,t){s(t)}),n.reload(),n.freshFields(r),n._responsive(),this},removeFields:function(e){e=i.convertToArray(e);var t=i.getFieldsFromArray(e);return t.parents(".ideal-wrap").remove(),this.reload(),this}})})(jQuery,window,document);
我将不胜感激你们可以提供的任何帮助。
干杯!