I have just found the solution for GWT 2.1.1 version. Here it is: First you do not use a 'SubmitButton' in your FormPanel, because it turns out that it causes all the troubles.
Use a 'Button' instead and add a 'ClickHandler' to it, and call 'your_form.submit()' inside the 'onClick()' method. You will find that after using 'Button' instead of 'SubmitButton' all the input fields in the form has lost their initial 'submit on Enter' behavior, which was observed at the beginning. Now attach to every input field a 'onKeyDown' handler(if you want, of course) and check the event's native key code upon 'ENTER', and if yes - submit the form. That is all, now the 'event.cancel()' part in the form's SubmitHandler is perfectly working. On Jan 5, 10:27 pm, Greg Dougherty <dougherty.greg...@mayo.edu> wrote: > I have the following code in a GWT 2.1.0 project: > > public void onSubmit (FormPanel.SubmitEvent event) > { > // This event is fired just before the form is submitted. We can take > // this opportunity to perform validation. > String filename = gDataFileUploader.getFilename (); > if (filename.length () == 0) > { > showAlert ("Need a valid File Name in before we can upload a > file!"); > event.cancel (); > } > > } > > Unfortunately, although it is called, the cancel () call doesn't stop > the submit from happening, and doesn't stop onSubmitComplete from > being called. Is this a GWT bug or a browser bug? (FireFox 3.6) > > TIA, > > Greg -- 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.