Form Disappears when switching Tabs in IE.

July 4th, 2009
  • Argh...

    This is driving me nuts.

    I have an app with a Tree on the left hand side and a TabPanel with 3 tabs on the right.

    Clicking an item in the Tree populates a form on two of the tabs.

    When the data is initially displayed in the forms, the form fields are disabled. Clicking a 'Modify' button on either of the two forms, enables the fields on that form so the user can edit the data. So far so good.

    However, in IE 7, if you click an item in the tree, go to the second tab, click the modify button to enable the form fields, then switch tabs again; when you go back to the second tab all the form fields are gone. This only happens to the form fields on the second tab.

    I've tried putting doLayout() every place I could think of to force those form fields to redraw, but to no avail.

    The weird thing is, if you put your mouse cursor over the area where the form fields are supposed to be, it switches to the I-beam. So the browser clearly knows that a form field is supposed to be there.

    My TabPanel:

    adTabs = new Ext.TabPanel(
    {
    id : 'ad-tabs'
    ,region : 'center'
    ,deferredRender : false
    ,activeTab : 0
    ,layoutOnTabChange : true


    // Create the Ad Tabs within the Ads TabPanel
    ,items:[
    { contentEl: 'ad-info', title: 'Ad Info', autoScroll: true }
    ,{ contentEl: 'ad-target', title: 'Ad Targeting', autoScroll: true }
    ,{ contentEl: 'ad-media', title: 'Ad Media', autoScroll: true }
    ]
    });


    This is how I'm loading data into the forms (Rails on the back-end):

    // Get the Ad Info from the DB
    adInfoFormPanel.getForm().load({
    url :'/ads/' + objNode.id + '.xml'
    ,method : 'GET'
    ,waitMsg :'Loading'
    });

    // Get the Ad Targeting Data from the DB
    adTargetFormPanel.getForm().load({
    url :'/targeting_selects/' + objNode.id + '.xml'
    ,method : 'GET'
    ,waitMsg:'Loading'
    });


    And here's where I enable/disable my form fields:

    function modifyAdTargetForm( iMode )
    {
    //Modify the button according to current functionality
    if ( iMode == CREATE iMode == VIEW iMode == UPDATE ) {
    changeFormBtnTxt( adTargetFormPanel, iMode );
    }

    // Tweak the form to match current functionality
    if ( (iMode == CREATE) (iMode == UPDATE) ) {
    // Create/Edit an Ad Info record. Enable all form fields.
    adTargetFormPanel.findById( AD_TARGET_FORM_DEST ).enable();
    adTargetFormPanel.findById( AD_TARGET_FORM_CABIN ).enable();
    adTargetFormPanel.findById( AD_TARGET_FORM_FLYER ).enable();
    adTargetFormPanel.findById( AD_TARGET_FORM_GENDER ).enable();
    adTargetFormPanel.findById( AD_TARGET_FORM_LOW ).enable();
    adTargetFormPanel.findById( AD_TARGET_FORM_HIGH ).enable();
    adTargetFormPanel.findById( AD_TARGET_FORM_START ).enable();
    adTargetFormPanel.findById( AD_TARGET_FORM_END ).enable();
    adTargetFormPanel.findById( AD_TARGET_FORM_ID ).enable();
    adTargetFormPanel.findById( AD_TARGET_FORM_AD_ID ).enable();
    // If the form is re-entering CREATE mode, reset it.
    if ( iMode == CREATE ) {
    adTargetFormPanel.getForm().reset();
    }
    } else if ( iMode == VIEW ) {
    // View an Ad Info record. Disable all form fields.
    adTargetFormPanel.findById( AD_TARGET_FORM_DEST ).disable();
    adTargetFormPanel.findById( AD_TARGET_FORM_CABIN ).disable();
    adTargetFormPanel.findById( AD_TARGET_FORM_FLYER ).disable();
    adTargetFormPanel.findById( AD_TARGET_FORM_GENDER ).disable();
    adTargetFormPanel.findById( AD_TARGET_FORM_LOW ).disable();
    adTargetFormPanel.findById( AD_TARGET_FORM_HIGH ).disable();
    adTargetFormPanel.findById( AD_TARGET_FORM_START ).disable();
    adTargetFormPanel.findById( AD_TARGET_FORM_END ).disable();
    adTargetFormPanel.findById( AD_TARGET_FORM_ID ).disable();
    adTargetFormPanel.findById( AD_TARGET_FORM_AD_ID ).disable();
    } else {
    // Something went wrong
    displayMsgBox( MSGBOX_TXT_ERROR_FORM_TYPE + iFormType
    ,MSGBOX_TITLE_ERROR
    ,Ext.MessageBox.ERROR
    ,Ext.MessageBox.OK );
    }
    }


    Any help and/or suggestions greatly appreciated!

    Thanks!


  • There is a bug in IE that makes height and width return 0 in elements hidden with display:none. This causes Ext JS to calculate sizes wrong.

    The workaround is to hide elements using visibility:hidden;position:aboslute;top:-10000px;left:-10000px (which can be selected with hideMode:'offsets').

    However, this is not the default hideMode, because it makes the browser slower (so only use hideMode:'offsets' when needed).


  • Does anyone know why when i load multiple tabs if the privious tabs i have, if they containt 2 panels, the lower panel is going down out of the screen? Only on IE i have that problem, in Mozilla and Safari works fine. Any sugestions?


  • I have come up with a solution to this issue, but unfortunately it involves the removal of some functionality.

    The whole point of having a VIEW (read-only) mode for my form was to force users to take an extra step in order to edit the DB data.

    If I get rid of my VIEW mode, meaning if I don't programatically disable/enable the form fields and simply allow users to edit the data as soon as the form is populated, this problem goes away.

    I've had a few IE problems of this nature, all centered around modifying a form in some way on an inactive Tab. Is this a known issue and something I should try to avoid doing in the future?


  • You can check your commas since the problem is only IE.


  • Ok, I have a tab, in wich i load a grid and a panel for showing details when you click on a record in the grid. When you load the tab it works fine, but, then you load another tab, it does not matter what it contains, if you switch back to the original tab, the details panel is gone, and it goes under the screen, it is still there but under the screen instead of its original location


  • I have also this thread but I did not search for now.In my opinion, it is related with id of elements.If elements have same id. But I do not know your situation


  • If it is not the solution than;I think you should explain more clearly.


  • Have you tried adding defaults:{hideMode:'offsets'} to the tabpanel config?


  • That was something I did not try. Now allow me to preface this next question with this statement :

    I'm relatively new to Ext development. :-)

    Why would that or should that have mattered?


  • Try putting a doLayout(), on the 'tabchange' event for the tabpanel.

    Read this thread:

    http://extjs.com/forum/showthread.php?t=41396


  • There is a bug in IE that makes height and width return 0 in elements hidden with display:none. This causes Ext JS to calculate sizes wrong.

    The workaround is to hide elements using visibility:hidden;position:aboslute;top:-10000px;left:-10000px (which can be selected with hideMode:'offsets').

    However, this is not the default hideMode, because it makes the browser slower (so only use hideMode:'offsets' when needed).

    AH! Thank you!

    That makes complete sense in light of the issues I've been having with forms & inactive tabs.


  • Try putting a doLayout(), on the 'tabchange' event for the tabpanel.

    Read this thread:

    http://extjs.com/forum/showthread.php?t=41396


    Cool, thanks. I'll keep that solution in mind. I've actually got three sets of Tabs to layout and hiding content offscreen may turn out to be impractical as the app grows in size.







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Form Disappears when switching Tabs in IE. , Please add it free.

    Navigation

    Calendar

    Blog

    Categories

    Archives
    Search

    Links

    Feeds and Credits