Validation error messages display problem

hai friends,

I have a problem with form validations. The following is my code

                    final TextField instCode = new TextField("Institution Code");
		instCode.addValidator(new RegexpValidator("^[a-zA-Z0-9]

*“, “Institution Code Must start String and end with digits”));
instCode.addValidator(new StringLengthValidator(“Institution Code Must be 5 to 15 characters long”, 5, 20, false));
instCode.setRequiredError(“Institution Code is required”);

		instCode.addListener(new BlurListener() {
			public void blur(BlurEvent event) {
					String temp=(String) instCode.getValue();
					if (institutionHome.isInstCodeExists(temp)) {

instCode.setComponentError(new UserError(“Institution is already registered with this code”));

		return instCode;

My problem is that when the institution is already registered with this institutionCode I want to display an error message and error message is showing correctly, but the
problem is even after changing the value also the same error message is showing.
…please help me…

thanks in advance…

First , I do not thing you really need a validation error for a radio field set because you could just have one of the fields checked by default. Most people would rather correct something then provide something. for instance.

Liferay Portal Development

hai chirag,

sorry my friend…i didn’t understand anything that what you say…please give the clarity…

Well, your red marked code-lines set a fixed error-message, that will be displayed always. Just remove them and call isValid() on your form to trigger the Validators.

hai Tobias Demuth ,

Thanks for your reply, but when I come to inside the following if codition I want to display an error message

if (instGenHome.isInstCodeExists(temp)) {

       // here I want to display an error message


Afterthat When I change the textfield value…this error message will be removed…this is what I want…

Please give me a solution…thanks in advance…

You should write a Validator for this and use it as you would use for example the StringLengthValidator above.