On 31 oct, 08:46, danblack <[email protected]> wrote:
> Here is my entry point
>
> package test.client;
>
> import com.google.gwt.core.client.EntryPoint;
> import com.google.gwt.dom.client.Document;
> import com.google.gwt.user.client.ui.FormPanel;
>
> public class Test_gwt_form implements EntryPoint {
>
> public void onModuleLoad() {
> FormPanel form = FormPanel.wrap(Document.get().getElementById(
> "testForm"));
> form.addSubmitHandler(new FormPanel.SubmitHandler() {
> public void onSubmit(FormPanel.SubmitEvent event) {
> event.cancel();
> }
> });
> }
>
> }
>
> Here my html
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
> <link type="text/css" rel="stylesheet" href="Test_gwt_form.css">
> <title>Test Project</title>
> <script type="text/javascript" language="javascript"
> src="test_gwt_form/test_gwt_form.nocache.js"></script>
> </head>
> <body>
> <h1>Test Project</h1>
> <form id="testForm" action="/test"><input type="text" /> <input
> type="submit" /></form>
> </body>
> </html>
>
> Form submits anyway :(
You're facing this issue:
http://code.google.com/p/google-web-toolkit/issues/detail?id=3973
This is because FormPanel.wrap(Element) doesn't create an iframe:
http://code.google.com/p/google-web-toolkit/source/browse/releases/1.7/user/src/com/google/gwt/user/client/ui/FormPanel.java#361
If you really do not want to submit within an iframe, then the
workaround is to use FormPanel.wrap(elt, true) to create the iframe,
so that the events are sinked, and then reset the form's target
(eventually using "_self" to target the "same window")
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---