Home > GWT - GXT > GXT – FormValidation und FieldMessages

GXT – FormValidation und FieldMessages

Form validation in GXT is cool thing. It calls the method

formPanel.isValid();

and all input fields are validated. But the error messages are English. That’s no problem. GXT allows us to change these messages. In a way;

TextField bezeichnung = new TextField<String>();
bezeichnung.setFieldLabel("Description");
bezeichnung.setName("description");
bezeichnung.setMessageTarget("side"); 

bezeichnung.setAllowBlank(false);
bezeichnung.getMessages().setBlankText("BlankMessageText");

bezeichnung.getMessages().setInvalidText("InvalidMessageText");

Where you see this message, it is defined by the message target property. You can use the following property.

Value Description
tooltip Display a tool tip when the user hovers over the field
title Display a default browser title attribute popup
side(default) Add an error icon to the right of the field with a popup on hover
none Do not display an error message
[element id] Add the error text directly to the innerHTML of the specified element

 

Advertisements
  1. Apomomewted
    23. January 2012 at 04:06

    Hello! Just want to say thank you for this interesting article!

  2. Mary
    26. February 2012 at 21:19

    Nice to read your blog

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: