text: if(typeof jQuery==="undefined"){throw new Error("该插件需要jQuery")}+(function($){function UnmarshalForm($element,options){this.unmarshal=function(){var content=null;var $eleArray=[];var selector="[name]:input";if(!options.unmarshalFile){selector+=":not(:file)"}if(!options.unmarshalDisabled){selector+=":enabled"}if(options.before($element)){content={};if($element.is(selector)){$eleArray.push($element)}$eleArray.push($element.find(selector));unmarshalValue($eleArray,options,content)}if(options.arrayJoin!==undefined&&options.arrayJoin!==null){$.each(content,function(key,ele){if($.isArray(ele)){content[key]=ele.join(options.arrayJoin)}})}options.complete($element,content);return content}}UnmarshalForm.DEFAULT_OPTIONS={unmarshalFile:false,unmarshalDisabled:false,arrayJoin:undefined,emptyToNull:true,noUnmarshal:null,before:function($element){return true},preHandle:function($target){return true},postHandle:function($target,value){return value},complete:function($element,content){}};function unmarshalValue($eleArray,options,content){$.each($eleArray,function(i,$ele){$ele.each(function(j,target){var $target=$(target);if($target.is(":radio")){unmarshalRadio($target,options,content)}else{if($target.is(":checkbox")){unmarshalCheckbox($target,options,content)}else{if($target.is("select")){unmarshalSelect($target,options,content)}else{unmarshalText($target,options,content)}}}})})}function unmarshalRadio($target,options,content){var key=$target.attr("name");if(!Object.prototype.hasOwnProperty.call(content,key)){if(options.noUnmarshal==="empty"){content[key]=""}else{if(options.noUnmarshal!=="no"){content[key]=options.noUnmarshal}}}if($target.is(":checked")){if(!options.preHandle($target)){return}content[key]=options.postHandle($target,$target.val())}}function unmarshalCheckbox($target,options,content){var key=$target.attr("name");if(!Object.prototype.hasOwnProperty.call(content,key)){if(options.noUnmarshal==="empty"){content[key]=[]}else{if(options.noUnmarshal!=="no"){content[key]=options.noUnmarshal}}}if($target.is(":checked")){if(!options.preHandle($target)){return}if(!$.isArray(content[key])){content[key]=[]}content[key].push(options.postHandle($target,$target.val()))}}function unmarshalSelect($target,options,content){var key=$target.attr("name");content[key]=options.postHandle($target,$target.val())}function unmarshalText($target,options,content){var key=$target.attr("name");var value=$target.val();if(options.emptyToNull&&value===""){value=null}if(!Object.prototype.hasOwnProperty.call(content,key)){if(options.preHandle($target)){content[key]=options.postHandle($target,value)}return}if(!$.isArray(content[key])){content[key]=[].concat(content[key])}content[key].push(options.postHandle($target,value))}var old=$.fn.unmarshalForm;$.fn.unmarshalForm=function(options){return(new UnmarshalForm(this,$.extend({},UnmarshalForm.DEFAULT_OPTIONS,options))).unmarshal()};$.fn.noConflict=function(){$.fn.unmarshalForm=old;return this};$.fn.unmarshalForm.Constructor=UnmarshalForm})(jQuery);+(function($){function MarshalForm($element,options,data){this.marshal=function(){var $eleArray=[];if(options.before($element,data)){marshalValue($element,options,data)}options.complete($element)}}MarshalForm.DEFAULT_OPTIONS={separator:null,before:function($element,data){return true},preHandle:function($target,key,value){return true},postHandle:function($target){},complete:function($element){}};function marshalValue($element,options,data){var selector=":input[name]";$.each(data,function(key,value){$element.find(":input[name='"+key+"']").each(function(index,ele){var $ele=$(ele);if($ele.is(":radio")){marshalCheck($ele,options,key,value)}else{if($ele.is(":checkbox")){if(value!==undefined&&value!==null){if(options.separator!==undefined&&options.separator!==null){if(!$.isArray(value)){value=value.split(options.separator)}}}else{var temp=value;value=[];value.push(temp)}value=[].concat(value);$.each(value,function(i,v){marshalCheck($ele,options,key,v)})}else{if($ele.is("select")){marshalSelect($ele,options,key,value)}else{if(value!==undefined&&value!==null){if(options.separator!==undefined&&options.separator!==null){if(!$.isArray(value)){value=value.split(options.separator)}}}else{var temp=value;value=[];value.push(temp)}value=[].concat(value);unmarshalText($ele,options,key,value[index])}}}})})}function marshalCheck($target,options,key,value){if($target.val()===value){if(options.preHandle($target,key,value)){$target.prop("checked","checked");options.postHandle($target)}}}function marshalSelect($target,options,key,value){if($target.is("[multiple]")){if(options.separator!==undefined&&options.separator!==null){if(!$.isArray(value)){value=value.split(options.separator)}}}if(options.preHandle($target,key,value)){value=[].concat(value);$.each(value,function(index,v){$target.find("option[value='"+v+"']").prop("selected","selected")});options.postHandle($target)}}function unmarshalText($target,options,key,value){if(options.preHandle($target,key,value)){$target.val(value);options.postHandle($target)}}var old=$.fn.marshalForm;$.fn.marshalForm=function(data,options){(new MarshalForm(this,$.extend({},MarshalForm.DEFAULT_OPTIONS,options),data)).marshal();return this};$.fn.noConflict=function(){$.fn.marshalForm=old;return this};$.fn.marshalForm.Constructor=MarshalForm})(jQuery);