I've had to write a new class and a bit of jsni to do this, and I'm not too
happy I had to do that when this should work out of the box. But, whatever.
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.*;
import com.foo.bar.shared.Callback;
public class Form extends HTMLPanel
{
private Callback<Void> onSubmit;
public Form(String html)
{
super("form", html);
setEvent( getElement() );
}
private native void setEvent(Element form)
/*-{
var that = this;
form.onsubmit = function()
{
[email protected]::handleOnSubmit()();
return false;
};
}-*/;
public Form setOnSubmit(Callback<Void> onSubmit)
{
this.onSubmit = onSubmit;
return this;
}
private void handleOnSubmit()
{
if (onSubmit != null)
onSubmit.call(null);
}
}
On Tuesday, March 24, 2015 at 6:18:21 PM UTC+5, Ali Akhtar wrote:
>
> Is it possible to allow HTML within a form panel, same as a HTML panel?
>
> Or to set onSubmit events to a HtmlPanel whose tag is "form"?
>
> There doesn't seem to be an event for onSubmit, so I can't seem to be able
> to do Event.sinkEvents( panel.getElement(), EVENT.ONSUBMIT)
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.