FormPanel not displaying the form
Actually, I solved my problem that stopped me some hours...
So I post here to share my "discovery" and hopefully save somebody else some worries (or, perhaps, help improving the JavaDoc, which is just non-existent for FormPanel in beta4).
I had a strange behavior: displaying a FormPanel in a UiBinder dialog with some fields and a button bar with OK/Cancel/Help buttons, I had only the button bar displayed. I tried without UiBinder, in a plain ContentPanel, etc. No luck.
Debugging, I found out that FormPanel was a SimpleContainer that accepted only one widget!
Somehow, I inverted my layout, having a div containing the FormPanel containing the widgets. For me, FormPanel was just a simple declaration, behaving similarly to HTML, adding a special behavior to the submit action.
In retrospect, the design is logical, so I don't criticize it, but as I wrote, I just want to help avoiding a pitfall.
I found other people falling in the same trap...
I also spent some hours in searching for another issue. It was hard, this one too...
FormPanel creates a hidden iframe as target of the form submit, meaning that the response from the server will go there. I suppose this allows to handle this answer (and to call onSubmitComplete event handler) without loosing the whole application.
I display a simple form with an upload field in a dialog (well, a Window), so when clicking on the OK button, I do: form.submit(); dialog.hide(); and I wait for the answer.
Well, in Firebug, I saw the POST request spinning endlessly, apparently lost in the limbo.
Trying to analyze with HttpFox, I got a strange error some people connected to a frame issue, so the pieces came in place! The hide apparently removes the dialog from the Dom, so the POST request has no place to update and fails.
The solution is simple: I do the hide in the onSubmitComplete handler.
Last trap (I hope): the POST request was empty, no fields, no upload field in particular.
Thanks to somebody else with a similar issue, I found out that I had to name the upload field (name="uploadedFile" in UiBinder, for example) to have it in the request. Logical, but easily overlooked...
Tags for this Thread