static/ext/src/data/Connection.js
function(form, url, params, options) {
        form = Ext.getDom(form);
        options = options || {};

        var id = Ext.id(),
            frame = document.createElement('iframe'),
            hiddens = [],
            encoding = 'multipart/form-data',
            buf = {
                target: form.target,
                method: form.method,
                encoding: form.encoding,
                enctype: form.enctype,
                action: form.action
            },
            addField = function(name, value) {
                hiddenItem = document.createElement('input');
                Ext.fly(hiddenItem).set({
                    type: 'hidden',
                    value: value,
                    name: name
                });
                form.appendChild(hiddenItem);
                hiddens.push(hiddenItem);
            },
            hiddenItem, obj, value, name, vLen, v, hLen, h;

        /*
         * Originally this behaviour was modified for Opera 10 to apply the secure URL after
         * the frame had been added to the document. It seems this has since been corrected in
         * Opera so the behaviour has been reverted, the URL will be set before being added.
         */
        Ext.fly(frame).set({
            id: id,
            name: id,
            cls: Ext.baseCSSPrefix + 'hide-display',
            src: Ext.SSL_SECURE_URL
        });

        document.body.appendChild(frame);

        // This is required so that IE doesn't pop the response up in a new window.
        if (document.frames) {
            document.frames[id].name = id;
        }

        Ext.fly(form).set({
            target: id,
            method: 'POST',
            enctype: encoding,
            encoding: encoding,
            action: url || buf.action
        });

        // add dynamic params
        if (params) {
            obj = Ext.Object.fromQueryString(params) || {};

            for (name in obj) {
                if (obj.hasOwnProperty(name)) {
                    value = obj[name];  
                    if (Ext.isArray(value)) {
                        vLen = value.length;
                        for (v = 0; v < vLen; v++) {
                            addField(name, value[v]);
                        }
                    } else {
                        addField(name, value);
                    }
                }
            }
        }

        Ext.fly(frame).on('load', Ext.Function.bind(this.onUploadComplete, this, [frame, options]), null, {single: !Ext.isOpera});
        form.submit();

        Ext.fly(form).set(buf);

        hLen = hiddens.length;

        for (h = 0; h < hLen; h++) {
            Ext.removeNode(hiddens[h]);
        }
    }
function(form, url, params, options) {
        form = Ext.getDom(form);
        options = options || {};

        var id = Ext.id(),
            frame = document.createElement('iframe'),
            hiddens = [],
            encoding = 'multipart/form-data',
            buf = {
                target: form.target,
                method: form.method,
                encoding: form.encoding,
                enctype: form.enctype,
                action: form.action
            },
            addField = function(name, value) {
                hiddenItem = document.createElement('input');
                Ext.fly(hiddenItem).set({
                    type: 'hidden',
                    value: value,
                    name: name
                });
                form.appendChild(hiddenItem);
                hiddens.push(hiddenItem);
            },
            hiddenItem, obj, value, name, vLen, v, hLen, h;

        /*
         * Originally this behaviour was modified for Opera 10 to apply the secure URL after
         * the frame had been added to the document. It seems this has since been corrected in
         * Opera so the behaviour has been reverted, the URL will be set before being added.
         */
        Ext.fly(frame).set({
            id: id,
            name: id,
            cls: Ext.baseCSSPrefix + 'hide-display',
            src: Ext.SSL_SECURE_URL
        });

        document.body.appendChild(frame);

        // This is required so that IE doesn't pop the response up in a new window.
        if (document.frames) {
            document.frames[id].name = id;
        }

        Ext.fly(form).set({
            target: id,
            method: 'POST',
            enctype: encoding,
            encoding: encoding,
            action: url || buf.action
        });

        // add dynamic params
        if (params) {
            obj = Ext.Object.fromQueryString(params) || {};

            for (name in obj) {
                if (obj.hasOwnProperty(name)) {
                    value = obj[name];  
                    if (Ext.isArray(value)) {
                        vLen = value.length;
                        for (v = 0; v < vLen; v++) {
                            addField(name, value[v]);
                        }
                    } else {
                        addField(name, value);
                    }
                }
            }
        }

        Ext.fly(frame).on('load', Ext.Function.bind(this.onUploadComplete, this, [frame, options]), null, {single: !Ext.isOpera});
        form.submit();

        Ext.fly(form).set(buf);

        hLen = hiddens.length;

        for (h = 0; h < hLen; h++) {
            Ext.removeNode(hiddens[h]);
        }
    }
function ( form , url , params , options ) { form = Ext . getDom ( form ) ; options = options || { } ; var id = Ext . id ( ) , frame = document . createElement ( 'iframe' ) , hiddens = [ ] , encoding = 'multipart/form-data' , buf = { target : form . target , method : form . method , encoding : form . encoding , enctype : form . enctype , action : form . action } , addField = function ( name , value ) { hiddenItem = document . createElement ( 'input' ) ; Ext . fly ( hiddenItem ) . set ( { type : 'hidden' , value : value , name : name } ) ; form . appendChild ( hiddenItem ) ; hiddens . push ( hiddenItem ) ; } , hiddenItem , obj , value , name , vLen , v , hLen , h ; /*
         * Originally this behaviour was modified for Opera 10 to apply the secure URL after
         * the frame had been added to the document. It seems this has since been corrected in
         * Opera so the behaviour has been reverted, the URL will be set before being added.
         */ Ext . fly ( frame ) . set ( { id : id , name : id , cls : Ext . baseCSSPrefix + 'hide-display' , src : Ext . SSL_SECURE_URL } ) ; document . body . appendChild ( frame ) ; // This is required so that IE doesn't pop the response up in a new window. if ( document . frames ) { document . frames [ id ] . name = id ; } Ext . fly ( form ) . set ( { target : id , method : 'POST' , enctype : encoding , encoding : encoding , action : url || buf . action } ) ; // add dynamic params if ( params ) { obj = Ext . Object . fromQueryString ( params ) || { } ; for ( name in obj ) { if ( obj . hasOwnProperty ( name ) ) { value = obj [ name ] ; if ( Ext . isArray ( value ) ) { vLen = value . length ; for ( v = 0 ; v < vLen ; v ++ ) { addField ( name , value [ v ] ) ; } } else { addField ( name , value ) ; } } } } Ext . fly ( frame ) . on ( 'load' , Ext . Function . bind ( this . onUploadComplete , this , [ frame , options ] ) , null , { single : ! Ext . isOpera } ) ; form . submit ( ) ; Ext . fly ( form ) . set ( buf ) ; hLen = hiddens . length ; for ( h = 0 ; h < hLen ; h ++ ) { Ext . removeNode ( hiddens [ h ] ) ; } }
Uploads a form using a hidden iframe.
@param {String/HTMLElement/Ext.Element} form The form to upload
@param {String} url The url to post to
@param {String} params Any extra parameters to pass
@param {Object} options The initial options
Uploads a form using a hidden iframe .