You found a bug! We've classified it as a bug in our system. We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext User
    Join Date
    Feb 2008
    Posts
    7
    Vote Rating
    0
    sanny is on a distinguished road

      0  

    Default [FIXED-129][2.x/3.x] Opera 10 upload form

    [FIXED-129][2.x/3.x] Opera 10 upload form


    Hello.

    I have a problem appeared in Opera 10 only. I have a form with uploadFile:true I'm submitting and waiting for the answer:

    Code:
    new Ext.FormPanel({
            border:false,
            title:false,
            id:'formpan5',
            cls:'normalcolor',
            fileUpload:true,
            autoHeight:true,
            reader:new Ext.data.JsonReader({
                root: "rows"
            },Code),
    Code:
                Ext.getCmp('formpan5').getForm().submit({
                    url:'/account/mygetcode.html',
                    params: {
                        id:selectedRow,
                        paytype:Ext.getCmp('paytype1').getGroupValue(),
                        dyntype:Ext.getCmp('dyntype1').getGroupValue(),
                        logotype:Ext.getCmp('logotype1').getGroupValue(),
                        design:radio_val(document.getElementById('design1').form.xdesign),
                        link:radio_val(document.getElementById('link1').form.xlink),
                        paycost:Ext.getCmp('paycost1').getGroupValue(),
                        roundcost:Ext.getCmp('roundcost1').getGroupValue(),
                        cost:Ext.getCmp('cost').getValue(),
                        linktext:Ext.getCmp('linktext').getValue()
                    },
                    waitMsg:'Получение HTML-кода',
                    waitTitle:'Обращение к серверу',
                    success:function(form, action){
                        codeTab=9;
                        for(var x=1;x<=9;x++){Ext.getCmp('codepan'+x).setVisible(0)}
                        Ext.getCmp('code').setValue(action.result.code);
                        Ext.getCmp('codepan9').setVisible(1);
                        Ext.getCmp('nextBtn5').setText('Закрыть');
                    },
                    failure:function(form, action){
                        Ext.Msg.alert("Ошибка",action.result.status);
                    }
                })
    I have the problem on the Ext.getCmp('code').setValue(action.result.code); line as in Opera I don't have action.result at all. Please take a look at attached screenshot. The problem appears in Opera 10 only.
    Attached Images

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Result is decoded from response. What's response? Go back through the call stack to the load handler of the iframe that receives the response document, and have a look round there.

  3. #3
    Ext User
    Join Date
    Feb 2008
    Posts
    7
    Vote Rating
    0
    sanny is on a distinguished road

      0  

    Default


    Ok, I'll try. The only thing I know is that the response is absolutely OK. I checked that with sniffer and at least that works in any other browser.

  4. #4
    Ext User
    Join Date
    Feb 2008
    Posts
    7
    Vote Rating
    0
    sanny is on a distinguished road

      0  

    Default


    I checked everyting and should say iframe is loaded without any problem. Iframe contents is ok. The same contents works in any other browser. So I should say it seems to be a bug.

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Find this function in ext-all-debug.js:

    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);
                        }
                    }
    
                    runCallback(o.success, o.scope, [r, o]);
                    runCallback(o.callback, o.scope, [o, true, r]);
    
                    if(!me.debugUploads){
                        setTimeout(function(){Ext.removeNode(frame);}, 100);
                    }
                }
    Set a break in it and step through it and watch how it creates the synthetic XHR.

  6. #6
    Ext User
    Join Date
    Feb 2008
    Posts
    7
    Vote Rating
    0
    sanny is on a distinguished road

      0  

    Default


    It seems quite strange. If I pause script execution anywhere in this code, everything seems ok - responseText and result looks good and script works.
    If I just execute the script without using Opera debugger, there is no responseText.

  7. #7
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    OK, so sounds like a timing issue?

    What if you executed that callback on a delay?

    Look at the line immediately after than function definition which adds it as a load listener:

    Code:
                Ext.EventManager.on(frame, LOAD, cb, this);
    Change it to

    Code:
                Ext.EventManager.on(frame, LOAD, cb, this, {delay: 100});
    Which will delay execution of the cb function for 100ms after the frame fires its ready event.

  8. #8
    Ext User
    Join Date
    Feb 2008
    Posts
    7
    Vote Rating
    0
    sanny is on a distinguished road

      0  

    Default


    You are right! I put 4000 delay and it works. Thanj you!
    Anyway I'm still sure this is a bug which should be fixed.

  9. #9
    Ext User
    Join Date
    Jun 2009
    Posts
    2
    Vote Rating
    0
    aep is on a distinguished road

      0  

    Default


    i worked around this by rerequesting the response in onSucess. form uploads response appears to be unrelyable in general.

  10. #10
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    83
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Apparently in Opera the 'load' event fires before the DOM is ready (and an extra DOMContentLoaded event handler is probably needed).