On 22 mar, 19:58, zizou84 <[email protected]> wrote: > Hi > I have a button in my html code: > <input name="commit" value="Sign In" type="submit" id="loginButton"> > i woul like to wrap it to a button: > Button loginButton=Button.wrap(DOM.getElementById("loginButton")); > but i am getting an exception: > java.lang.AssertionError: null > at com.google.gwt.dom.client.ButtonElement$.as(ButtonElement.java: > 33) > at com.google.gwt.user.client.ui.Button.<init>(Button.java:115) > at com.google.gwt.user.client.ui.Button.wrap(Button.java:56) > > How could i wrap my html button to a button object
You can't. The Button widget uses a <button> element. In your case, I'd change the HTML into: <button name="commit" type="submit"id="loginButton">Sign In</ button> and then use a SubmitButton.wrap(...) Or, probably better in 99% cases, don't wrap the button into a widget: what's your use-case? given that it's a submit button you'd better handle form submission than clicks on the button (typing the enter key from within a text input might trigger form submit without actually simulating a click on the submit button, depends on browsers), and there's no real advantage to using widgets instead of DOM elements apart from events. -- 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.
