PDA

View Full Version : Field validation



pedrosousa
4 Dec 2008, 11:47 AM
Hi everyone,

I have a question. I was trying to implement a server side validation for form posts. When I validate the data from form I send back the validation errors and set the Fields as invalid (using forceInvalid). Why this method forceInvalid() disables, field validation logic.

It should clear the invalid on field blur (runnig field validate method).

Anyone can help?

Thanks,

pedrosousa
5 Dec 2008, 8:45 AM
The class Field.java as the following:



@SuppressWarnings("deprecation")
protected boolean validateValue(String value) {
if (forceInvalidText != null) {
markInvalid(forceInvalidText);
return false;
}
return true;
}
Why only validate value if forceInvalidTextis null? I think the best way is: when forcing invalid it should show the field invalid information, and in the first focus should validate again.

This is very useful when using validation in server side. Receive the errors, forceInvalid the fields, and in the first focus validate again.


I would like to know someone else, point view.

pjesus
5 Dec 2008, 8:59 AM
The class Field.java as the following:



@SuppressWarnings("deprecation")
protected boolean validateValue(String value) {
if (forceInvalidText != null) {
markInvalid(forceInvalidText);
return false;
}
return true;
}
Why only validate value if forceInvalidTextis null? I think the best way is: when forcing invalid it should show the field invalid information, and in the first focus should validate again.

This is very useful when using validation in server side. Receive the errors, forceInvalid the fields, and in the first focus validate again.


I would like to know someone else, point view.

Hi all.

I agree with --pedrosousa in this issue. ExtJs behavior for cases like this is exactly like he
suggested.

In my opinion this is a bug.

Regards

Paulo Jesus