src/main/webapp/jquery-easyui-1.3.3/src/jquery.form.js
/**
     * load form data
     * if data is a URL string type load from remote site,
     * otherwise load from local data object.
     */
load form data
if data is a URL string type load from remote site,
otherwise load from local data object.
load form data if data is a URL string type load from remote site otherwise load from local data object .
function load(target, data) {
        if (!$.data(target, 'form')) {
            $.data(target, 'form', {
                options: $.extend({}, $.fn.form.defaults)
            });
        }
        var opts = $.data(target, 'form').options;
        if (typeof data == 'string') {
            var param = {};
            if (opts.onBeforeLoad.call(target, param) == false) return;
            $.ajax({
                url: data,
                data: param,
                dataType: 'json',
                success: function (data) {
                    _load(data);
                },
                error: function () {
                    opts.onLoadError.apply(target, arguments);
                }
            });
        } else {
            _load(data);
        }
        function _load(data) {
            var form = $(target);
            for (var name in data) {
                var val = data[name];
                var rr = _checkField(name, val);
                if (!rr.length) {
                    var f = form.find('input[numberboxName="' + name + '"]');
                    if (f.length) {
                        f.numberbox('setValue', val);	
                    } else {
                        $('input[name="' + name + '"]', form).val(val);
                        $('textarea[name="' + name + '"]', form).val(val);
                        $('select[name="' + name + '"]', form).val(val);
                    }
                }
                _loadCombo(name, val);
            }
            opts.onLoadSuccess.call(target, data);
            validate(target);
        }
        function _checkField(name, val) {
            var rr = $(target).find('input[name="' + name + '"][type=radio], input[name="' + name + '"][type=checkbox]');
            rr._propAttr('checked', false);
            rr.each(function () {
                var f = $(this);
                if (f.val() == String(val) || $.inArray(f.val(), val) >= 0) {
                    f._propAttr('checked', true);
                }
            });
            return rr;
        }
        function _loadCombo(name, val) {
            var form = $(target);
            var cc = ['combobox', 'combotree', 'combogrid', 'datetimebox', 'datebox', 'combo'];
            var c = form.find('[comboName="' + name + '"]');
            if (c.length) {
                for (var i = 0; i < cc.length; i++) {
                    var type = cc[i];
                    if (c.hasClass(type + '-f')) {
                        if (c[type]('options').multiple) {
                            c[type]('setValues', val);
                        } else {
                            c[type]('setValue', val);
                        }
                        return;
                    }
                }
            }
        }
    }
function load ( target , data ) { if ( ! $ . data ( target , 'form' ) ) { $ . data ( target , 'form' , { options : $ . extend ( { } , $ . fn . form . defaults ) } ) ; } var opts = $ . data ( target , 'form' ) . options ; if ( typeof data == 'string' ) { var param = { } ; if ( opts . onBeforeLoad . call ( target , param ) == false ) return ; $ . ajax ( { url : data , data : param , dataType : 'json' , success : function ( data ) { _load ( data ) ; } , error : function ( ) { opts . onLoadError . apply ( target , arguments ) ; } } ) ; } else { _load ( data ) ; } function _load ( data ) { var form = $ ( target ) ; for ( var name in data ) { var val = data [ name ] ; var rr = _checkField ( name , val ) ; if ( ! rr . length ) { var f = form . find ( 'input[numberboxName="' + name + '"]' ) ; if ( f . length ) { f . numberbox ( 'setValue' , val ) ; } else { $ ( 'input[name="' + name + '"]' , form ) . val ( val ) ; $ ( 'textarea[name="' + name + '"]' , form ) . val ( val ) ; $ ( 'select[name="' + name + '"]' , form ) . val ( val ) ; } } _loadCombo ( name , val ) ; } opts . onLoadSuccess . call ( target , data ) ; validate ( target ) ; } function _checkField ( name , val ) { var rr = $ ( target ) . find ( 'input[name="' + name + '"][type=radio], input[name="' + name + '"][type=checkbox]' ) ; rr . _propAttr ( 'checked' , false ) ; rr . each ( function ( ) { var f = $ ( this ) ; if ( f . val ( ) == String ( val ) || $ . inArray ( f . val ( ) , val ) >= 0 ) { f . _propAttr ( 'checked' , true ) ; } } ) ; return rr ; } function _loadCombo ( name , val ) { var form = $ ( target ) ; var cc = [ 'combobox' , 'combotree' , 'combogrid' , 'datetimebox' , 'datebox' , 'combo' ] ; var c = form . find ( '[comboName="' + name + '"]' ) ; if ( c . length ) { for ( var i = 0 ; i < cc . length ; i ++ ) { var type = cc [ i ] ; if ( c . hasClass ( type + '-f' ) ) { if ( c [ type ] ( 'options' ) . multiple ) { c [ type ] ( 'setValues' , val ) ; } else { c [ type ] ( 'setValue' , val ) ; } return ; } } } } }
load form data
 if data is a URL string type load from remote site,
 otherwise load from local data object.
load form data if data is a URL string type load from remote site otherwise load from local data object .
// set numberbox value /**
         * check the checkbox and radio fields
         */