TextField validate

24 views
Skip to first unread message

lvcster

unread,
Feb 27, 2008, 5:52:30 PM2/27/08
to GWT-Ext Developer Forum
How do I call a method that might do a validation, or anything for
argument sake, when the field looses a focus.

Thanks in advance.

lvcster.

alberto33

unread,
Mar 3, 2008, 10:37:35 PM3/3/08
to GWT-Ext Developer Forum

Elvis Hlongwane

unread,
Mar 4, 2008, 2:55:15 PM3/4/08
to gwt...@googlegroups.com
I sent the wrong question...
I wanted to ask about comparing the values of 2 fields when either of
the 2 fields looses focus and the field are both not empty.

More like validating password comfirmation.

Any done this before(Using Validator interface).

thanks.

--
Elvis Hlongwane
Cel: 082 255 1532

Hugo Forte

unread,
Mar 5, 2008, 7:02:11 AM3/5/08
to GWT-Ext Developer Forum
Aloha,

I added the following validator to my password, it could be modified
as you see fit.

//Password
final TextField password = new TextField("Password",
"password", 230);
password.setAllowBlank(false);
password.setPassword(true);
accountInfo.add(password);

//Retyped password
final TextField passwordRetype = new TextField("Retype
Password",
"passwordRetype", 230);
passwordRetype.setAllowBlank(false);
passwordRetype.setPassword(true);

Validator validatePassword = new Validator() {
public boolean validate(String value)
throws ValidationException {
String passwordText = password.getText();
if (!value.equals(passwordText)) {
throw new ValidationException("Passwords do
not match");
} else if (value.length() < 6) {
throw new ValidationException(
"Password has to be at least 6 characters
long");
} else {
return true;
}
}
};

passwordRetype.setValidator(validatePassword);
On Mar 4, 1:55 pm, "Elvis Hlongwane" <lvcs...@gmail.com> wrote:
> I sent the wrong question...
> I wanted to ask about comparing the values of 2 fields when either of
> the 2 fields looses focus and the field are both not empty.
>
> More like validating password comfirmation.
>
> Any done this before(Using Validator interface).
>
> thanks.
>
>
>
> On Tue, Mar 4, 2008 at 5:37 AM, alberto33 <albert...@gmail.com> wrote:
>
> > Take a look at:
>
> > http://gwt-ext.com/docs/gwtext2/com/gwtext/client/widgets/form/event/...

Elvis Hlongwane

unread,
Mar 5, 2008, 2:49:26 PM3/5/08
to gwt...@googlegroups.com
That's what im talking about. Thanks a mil Aloha.
Reply all
Reply to author
Forward
0 new messages