1. #1
    Ext User
    Join Date
    Mar 2009
    Posts
    3
    Vote Rating
    0
    yakamax is on a distinguished road

      0  

    Question Why window popup is open when FormPanel is submitted?

    Why window popup is open when FormPanel is submitted?


    I have a form panel :
    Code:
    FormPanel panelPanel = new FormPanel();
    panelPanel.setFrame(false);
    panelPanel.setHeaderVisible(false);
    panelPanel.setHeading("Upload xml config");
    panelPanel.setSize(300, -1);
    panelPanel.setLabelAlign(LabelAlign.TOP);
    panelPanel.setButtonAlign(HorizontalAlignment.CENTER);
    panelPanel.setMethod(Method.POST);
    panelPanel.setAction(GWT.getModuleBaseURL() + "MyFormHandler");
    with one field attached :
    Code:
    final TextField<String> name = new TextField<String>();
    file.setFieldLabel("Name");
    panelPanel.add(file, formData);
    I perform a submit :
    Code:
    panelPanel.submit();

    When submit is perfomed :
    In Hosted Mode, an Hosted Mode window is opened.
    In Firefox, no window is open : OK
    In Internet Explorer (7 et 8), an Internet Explorer window is opened.

    So my problem is :
    In Hosted Mode and Internet Explorer (Hosted Mode is based on IE), my Listener is not handled :

    Code:
    panelPanel.addListener(Events.Submit, new Listener<FormEvent>() {
    ...
    }
    So why window popup is open when FormPanel is submitted in Hosted Mode and Internet Explorer?

    Thank you all,
    Max

  2. #2
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    870
    Vote Rating
    1
    micgala is on a distinguished road

      0  

    Default


    Hi.

    This will be fixed in 2.1 (it is already fixed for subscribers).
    You can take a look in my signature. There you will find a thread with a solution for you.

    Regards,
    Michel.

  3. #3
    Ext User
    Join Date
    Mar 2009
    Posts
    3
    Vote Rating
    0
    yakamax is on a distinguished road

      0  

    Thumbs up [FIXED]

    [FIXED]


    Perfect! Thank you.

    http://www.extjs.com/forum/showthrea...110#post394110

    My Full Fixed class (FixedFormPanel.java):

    Code:
    package com.toto.client.widget;
    
    import com.extjs.gxt.ui.client.core.XDOM;
    import com.extjs.gxt.ui.client.widget.form.FormPanel;
    import com.google.gwt.user.client.DOM;
    import com.google.gwt.user.client.Element;
    import com.google.gwt.user.client.ui.impl.FormPanelImpl;
    
    public class FixedFormPanel extends FormPanel {
        
        @Override
        protected void onAttach() {
            super.onAttach();
            Element iFrame = getIFrameElement();
            Element fixedIFrame = createFixedFrame();
            
            FormPanelImpl impl = getImpl();
            impl.unhookEvents(iFrame, getLayoutTarget().dom);
            XDOM.getBody().removeChild(iFrame);
            
            XDOM.getBody().appendChild(fixedIFrame);
            impl.hookEvents(fixedIFrame, getLayoutTarget().dom, this);
            
            setIFrameElement(fixedIFrame);
        }
        
        private Element createFixedFrame() {
            Element dummy = DOM.createDiv();
            DOM.setInnerHTML(dummy, "<iframe src=\"javascript:''\" name='" + getFrameName()
                + "' style='position:absolute;width:0;height:0;border:0'>");
    
            return DOM.getFirstChild(dummy);
          }
        
        private native String getFrameName() /*-{
            return this.@com.extjs.gxt.ui.client.widget.form.FormPanel::frameName;
        }-*/;
        
        private native Element getIFrameElement() /*-{
            return this.@com.extjs.gxt.ui.client.widget.form.FormPanel::iframe;
        }-*/;
        
        private native void setIFrameElement(Element fixedIFrame) /*-{
            this.@com.extjs.gxt.ui.client.widget.form.FormPanel::iframe = fixedIFrame;
        }-*/;
        
        private native FormPanelImpl getImpl() /*-{
            return @com.extjs.gxt.ui.client.widget.form.FormPanel::impl;
        }-*/;
    
    }
    So use it like that :

    Code:
    FormPanel panelPanel = new FixedFormPanel();
    Thanks

Thread Participants: 1