Skip to content

Instantly share code, notes, and snippets.

@porcelli
Created June 10, 2013 06:45
Show Gist options
  • Save porcelli/5746952 to your computer and use it in GitHub Desktop.
Save porcelli/5746952 to your computer and use it in GitHub Desktop.
sample gwt bad code
final FormPanel form = new FormPanel();
form.setEncoding(FormPanel.ENCODING_MULTIPART);
form.setMethod(FormPanel.METHOD_POST);
form.addStyleName("table-center");
form.addStyleName("demo-FormPanel");
VerticalPanel holder = new VerticalPanel();
holder.add(new Label("User ID"));
TextBox userid = new TextBox();
userid.setName("userid");
holder.add(userid);
holder.add(new Label("Password"));
PasswordTextBox passwd = new PasswordTextBox();
passwd.setName("passwd");
holder.add(passwd);
holder.add(new Button("Submit", new ClickListener()
{
public void onClick(Widget sender)
{
// form.submit();
}
}));
form.add(holder);
// form.setAction("url");
form.addFormHandler(new FormHandler()
{
public void onSubmit(FormSubmitEvent event)
{
// if (something_is_wrong)
// {
// Take some action
// event.setCancelled(true);
// }
}
public void onSubmitComplete(
FormSubmitCompleteEvent event)
{
Window.alert(event.getResults());
}
});
RootPanel.get("demo").add(form);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment