Hi,


I have a form and some inputs on it. I marked one input as required. Then I expected to get a error message when posting an empty form. By I did not get any messages. Then I added a length validator with a minimum = 1. And again I had not got any messages. Then I started debugging and found some strange code in javax.faces.component.UIInput.validate(FacesContext). I was insterested with the following line #263:

if (submittedValue == null) return;

So, when the input field is empty the submitted values is not validated. To test this assumption I have changed length validator minimum to 3 and started testing with submiting one white space. I had got a error message from the length validator!!!

Finally, I have found that all empty fields submit nulls and this nulls are not validated. And now do not know how to get the required attribute working?

Then I have found more interesting features. A have posted one char and got a error message (because minmum length is 3). Then I am deleting this character and posting again an empty value. Now at applying request values RequestParameterMap reports that it not contains the parameter. Really it contains it but the value is null and the org.apache.myfaces.context.servlet.AbstractAttributeMap.containsKey(Object) returns false. As a result the component value is not change and the validation is executed against the old value!...


Serge Bogatyrjov.

Reply via email to