Results 1 to 3 of 3

Thread: submit returns no response

  1. #1
    Sencha User jaforom's Avatar
    Join Date
    Jun 2009
    Posts
    20

    Default submit returns no response

    Hi all,

    when I make a submit(), the response came back empty in the action parameter of success event, with no result property. In firedebug I see the response in JSON format. Any idea? Thanks

  2. #2
    Sencha User jaforom's Avatar
    Join Date
    Jun 2009
    Posts
    20

    Default

    The code of FormPanel is

    Code:
        var kmlForm = new Ext.FormPanel({
            fileUpload: true,
            frame: false,
            bodyStyle: 'padding:10px 10px 10px 10px;',
            autoHeight:true,
            defaults: {
                anchor: '95%',
                allowBlank: false,
                msgTarget: 'side'
            },
            items: [{
                xtype: 'fileuploadfield',
                id: 'kmlFile',
                name: 'kmlFile',
                fieldLabel:'',
                buttonText: 'Examinar',
                hideLabel:true
            },{
                xtype: 'hidden',
                id: 'domain',
                name: 'domain',
                value: documentDomain
            }],
            buttons: [{
                text: 'Cargar',
                handler: function(){
                    var fp = this.ownerCt.ownerCt;
                    if (fp.getForm().isValid()) {
                        fp.getForm().submit({url:grafcan.urlLoadKML,method:'POST',
                                             success:function(form, action){
                                                 alert('submit ok')},
                                             failure:function(form, action){
                                                 alert('submit failed')}/*,waitTitle:'Espere, por favor',waitMsg:'Cargando KML...'*/});
                    }
                }
            }]
        });
    The response is the same: empty responseText of action.response. There's no action.result property.

    In firebug I see that the response is like

    Code:
    {"success":true,"data":{"id":1,"url":"http:\/\/...\/KML\/8458_l0gg1qjiva80to529ifd7tvq42.kml","error":""}}

  3. #3
    Sencha User jaforom's Avatar
    Join Date
    Jun 2009
    Posts
    20

    Default

    I found the reason: there was an error (famous "Denied access" error) in the callback function (ext-all.js), when the following line was executed:


    Code:
    doc = frame.contentWindow.document || frame.contentDocument || WINDOW.frames[id].document;
    I return the HTML with a javascript statement that modifies document's domain property.

    Code:
            function cb(){
                var me = this,
                    // bogus response object
                    r = {responseText : '',
                         responseXML : null,
                         argument : o.argument},
                    doc,
                    firstChild;
    
                try{ 
                    doc = frame.contentWindow.document || frame.contentDocument || WINDOW.frames[id].document;>:)
                    if(doc){
                        if(doc.body){
                            if(/textarea/i.test((firstChild = doc.body.firstChild || {}).tagName)){ // json response wrapped in textarea                        
                                r.responseText = firstChild.value;
                            }else{
                                r.responseText = doc.body.innerHTML;
                            }
                        }
                        //in IE the document may still have a body even if returns XML.
                        r.responseXML = doc.XMLDocument || doc;
                    }
                }
                catch(e) {}
    
                Ext.EventManager.removeListener(frame, LOAD, cb, me);
    
                me.fireEvent(REQUESTCOMPLETE, me, r, o);
                
                function runCallback(fn, scope, args){
                    if(Ext.isFunction(fn)){
                        fn.apply(scope, args);
                    }
                }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •