Monday, January 7, 2013

How to validate TextBox fields?

I'm having problems in getting started with GWT Validation. I just want to validate some form fields on a page.
I started like this, but don't know how to go on:

class Person {
  @Size(min = 4, message = "Name too short.")
  private String name;

  Person(name) {
     this.name = name;
  }
}

class MyForm {
    @UiField
    TextBox name;

    @UiHandler
    void onClick("saveButton") {
        new Person(name);
        //...
    }
}


What do I have to do in order to validate the field now, and show the error message from the annotation on the page?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/mse3aWjA5AUJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment