Sorry for double posting. I thought my mailprovider would have a
problem ...
On Wed, 12 Apr 2006, Joerg Bredlau wrote:
Hello,
I'm working on validation for my InputComponents. For each of the components
I want individual messages if the field is empty.
I know, thats impossible with the standard required-Validator.
I tried out OptionalValidatorFramwork, but it doesn't work for me.
Now I want to make the validation by hand in valueChangeListeners, added to
the components. My Problem is: The ValueChangeListener is executed before
model_update,thats right? How can I get back to ValidationPhase(?) when the
field is empty, to display the input-page again and not update my model?
Here is the codefragment I'm working on:
public void lastnameChange(ValueChangeEvent event) {
String lastname = ((String) event.getNewValue()).trim();
String compId = event.getComponent().getId();
if (( lastname== null) || (lastname.length() == 0)) {
FacesUtils.addInfoMessage(compId, "Please enter your name.");
// TODO go back to input page with old value
}
}
Or is there another approach for validation with individual messages to
empty fields?
Thanks
Joerg