GWT FileUpload: Adding Widgets to a FormPanel

If you build your first GWT form, for example something like that:

<!DOCTYPE ui:UiBinder SYSTEM "">
<ui:UiBinder xmlns:ui=""
<g:FormPanel ui:field="form"> 
<g:FileUpload ui:field="uploadField" name="file"/>
<g:SubmitButton ui:field="submitButton">Upload</g:SubmitButton>

And your console keeps telling you during runtime something like this: “java.lang.IllegalStateException: SimplePanel can only contain one child widget”. Instead of writing a long page of explanations and complaints like I did before, it’s simply like that:

“Just put all your widgets in a panel (like HorizontalPanel) and add that panel to the FormPanel.” (Jake − cf. comment below)

Thanks Jake! 🙂

3 Replies to “GWT FileUpload: Adding Widgets to a FormPanel”

    1. Thanks for your comment Jake!

      You are completely right! For some reason, It did not come to my mind to put in the form panel another panel first. That’s it. I will update the post accordingly, however, there will not be much left afterwards. 😉

      Thanks again,

Leave a Reply

Your email address will not be published. Required fields are marked *