Sorry, I've never used traditional forms in gwt, so I can't help,
other than to ask, are you sure you need to use traditional forms?

On Dec 9, 11:42 pm, Island <[email protected]> wrote:
> Hi, there
>
> I am new to GWT, so maybe this question has been answered somewhere
> else.
>
> The question is regarding the FormPanel submission. I defined a
> FileUploadDialog class, which is inherited from GWT DialogBox class.
>
> In my FileUploadDialog constructor, I decided to attach a FormPanel to
> it and, then I added several widgets to the FormPanel. The code is
> like the following:
> =========================================================================== 
> =====
>         public FileUploadDialog() {
>
>             setText("Upload Files");
>             // Create a FormPanel and point it at a service.
>              form = new FormPanel();
>              form.setAction("/splat/uploadFileHandler");
>
>              // Because we're going to add a FileUpload widget, we'll need to
> set the
>              // form to use the POST method, and multipart MIME encoding.
>              form.setEncoding(FormPanel.ENCODING_MULTIPART);
>              form.setMethod(FormPanel.METHOD_POST);
>              VerticalPanel panel = new VerticalPanel();
>              form.setWidget(panel);
>
>              RadioButton phyBtn = new RadioButton("FileType",
> "PhysicalFile");
>              RadioButton virBtn = new RadioButton("FileType", "VirtualFile");
>              phyBtn.setChecked(true);
>              panel.add(phyBtn);
>              panel.add(virBtn);
>
>              // Create a FileUpload widget.
>              final FileUpload upload = new FileUpload();
>              upload.setTitle("select file");
>              upload.setName("uploadFormElement");
>              panel.add(upload);
>
>              // Add a 'submit' button.
>              panel.add(new Button("Upload", new ClickListener() {
>                public void onClick(Widget sender) {
>                  form.submit();
>                }
>              }));
>
>              // Add a 'submit' button.
>              panel.add(new Button("OK", new ClickListener() {
>                public void onClick(Widget sender) {
>                  hide();
>                }
>              }));
>
>              // Add an event handler to the form.
>              form.addFormHandler(new FormHandler() {
>                public void onSubmit(FormSubmitEvent event) {
>                  // This event is fired just before the form is submitted. We
> can take
>                  // this opportunity to perform validation.
>                  if (upload.getFilename().length() == 0) {
>                            Window.alert("please select file");
>                            event.setCancelled(true);
>
>                  }
>                }
>
>                public void onSubmitComplete(FormSubmitCompleteEvent event) {
>                    Window.alert(event.getResults());
>
>                }
>              });
>
>              setWidget(form);
>
>            }
> =========================================================================== 
> =====
>
> but it looks like I could not get any parameters from the
> uploadFileHandler servlet, I am guessing this maybe because this
> FormPanel is attached to a DialogBox, but I do not understand why?

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to