Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #11
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    102
    Vote Rating
    1
    scaswell1 is on a distinguished road

      0  

    Default


    The use case for this particular situation is to open a window that harbors a FormPanel with two fields (one being the FileUploadField.) This window is modal, and does not close until the onSubmit event finishes processing (which should be after the submit completes, if I understand the API correctly.)

    Code:
    Window w = new Window();
    FormPanel fp = new FormPanel();
    VerticalLayoutContainer vlc = new VerticalLayoutContainer();
    w.setWidget(fp);
    fp.setWidget(vlc);
    ... // other widget setup -- FileUploadField and TextArea into vlc, etc
    
    
    fp.setMethod(FormPanel.Method.POST);
    fp.setEncoding(FormPanel.Encoding.MULTIPART);
    fp.setAction(GWT.getHostPageBaseURL() + "datatransfer");
    fp.addSubmitHandler(new SubmitHandler() {
                    
        @Override
        public void onSubmit(SubmitEvent event) {
            // processing
            Utils.getSvc().doThing(selected, new AsyncCallback<AdViewGwt>() {
                                    
                @Override
                public void onFailure(Throwable caught) {
                    Utils.reportError(caught, "Unable to attach file!");
                }
    
    
                @Override
                public void onSuccess(BaseModel result) {
                    selected.set("addFile", null);
                    w.hide();            
                }
            });
        }
    });
    note.addButton(new TextButton("Save", new SelectHandler() {
        
        @Override
        public void onSelect(SelectEvent ce) {
            fp.submit();
        }
    }));
    That's the general gist/use-case. To my understanding, the FormPanel should always be attached in this scenario, right?

  2. #12
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Agreed - that looks reasonable. Without being able to run it and reproduce it, I can't say much more without lots of guessing.

    I brought up attach/detach because you said that the synthesizedFrame was null. This is set to a non-null value in com.sencha.gxt.widget.core.client.form.FormPanel.onAttach(), which should be called when the widget is attached to the dom (when w.show() gets called in the above code). If onAttach isn't getting called, you'll have all kinds of other issues as well, like the fact that events won't be firing in fields/buttons, etc, so that almost certainly is working. This field then is only nulled out in onDetach().

    If it is null, the FormPanel isn't attached.

  3. #13
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    102
    Vote Rating
    1
    scaswell1 is on a distinguished road

      0  

    Default


    In my current debugging session, I am clicking a button that calls form.submit();

    It is hitting FormPanel line 399 (first line of onDetach()) and THEN going to line 370 (submit()).

  4. #14
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    102
    Vote Rating
    1
    scaswell1 is on a distinguished road

      0  

    Default


    See the (hopefully attached) image for Netbeans' representation of the callstack.
    Attached Images

  5. #15
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    102
    Vote Rating
    1
    scaswell1 is on a distinguished road

      0  

    Default


    From this, it appears that the onSubmit/SubmitHandler are called when FormPanel.submit() is fired, not when the submission is complete. This would explain a lot. Is there an alternative way to listen for when the submission is completed?

    EDIT: SubmitComplete handler. I'm dumb.
    Last edited by scaswell1; 22 Jan 2013 at 1:19 PM. Reason: I'm dumb.

  6. #16
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Sorry for the confusion - I should have caught that as well (since you are hiding the window in your submit event handler).

    Is there still an issue, or can I close this bug?

  7. #17
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    102
    Vote Rating
    1
    scaswell1 is on a distinguished road

      0  

    Default


    You can close it - that was definitely the problem. Really sorry for time drain!

  8. #18
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    No problem - In my brief look to see if I should add additional documentation for this point, I found this:
    Code:
        /**
         * Fired when the form is submitted.
         * 
         * <p>
         * The FormPanel must <em>not</em> be detached (i.e. removed from its parent
         * or otherwise disconnected from a {@link RootPanel}) until the submission
         * is complete. Otherwise, notification of submission will fail.
         * </p>
         * 
         * @param event the event
         */
        void onSubmit(SubmitEvent event);
    Clearly we should mention this in at least one other place - I'll make a note of this on the event itself, and perhaps in the FormPanel too.

Thread Participants: 2