form.submit(), as in

Button okBtn = new Button("OK");
okBtn.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
                form.submit();
        }
});

On Feb 14, 5:23 am, learning coding <learning.codin...@gmail.com>
wrote:
> Hi all,
>
> I am new to GWT ,
> I am writing RPC code to transfer file from client to server.
>
> I have a client side  like this.
> But i dont understand what i have to call from service class.
>
> i dont know what should i write in interface class and asyncronous
> class.
>
> Plz some one Help.
> .
>
> public class FileUploader{
>         private ControlPanel cp;
>         private FormPanel form = new FormPanel();
>         private FileUpload fu =  new FileUpload();
>         public FileUploader(ControlPanel cp) {
>                 this.cp = cp;
>                 this.cp.setPrimaryArea(getFileUploaderWidget());
>         }
>         @SuppressWarnings("deprecation")
>         public Widget getFileUploaderWidget() {
>                 form.setEncoding(FormPanel.ENCODING_MULTIPART);
>                 form.setMethod(FormPanel.METHOD_POST);
>                 // form.setAction
>                                                 (/* WHAT SHOULD I PUT
> HERE */);
>                 VerticalPanel holder = new VerticalPanel();
>                 fu.setName("upload");
>                                         holder.add(fu);
>                 holder.add(new Button("Submit", new ClickHandler() {
>                         public void onClick(ClickEvent event) {
>                        GWT.log("You selected: " + fu.getFilename(),
> null);
>                        form.submit();
>                       }
>                         }));
>                 form.addSubmitHandler(new FormPanel.SubmitHandler() {
>
>                         public void onSubmit(SubmitEvent event) {
>                                 if (!"".equalsIgnoreCase(fu.getFilename())) {
>                                         GWT.log("UPLOADING FILE????", null);
>                                         // NOW WHAT????
>                                         }
>                                 else{
>                                         event.cancel(); // cancel the event
>                                         }
>                                 }
>                         });
>                 form.addSubmitCompleteHandler(new 
> FormPanel.SubmitCompleteHandler()
> {
>                         public void onSubmitComplete(SubmitCompleteEvent 
> event) {
>                                 Window.alert(event.getResults());
>                                 }
>                         });
>                 form.add(holder);
>                 return form;
>                 }
>         }

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

Reply via email to