Hi,

On Wed, 12 Apr 2006, Volker Weber wrote:

[...]

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

here you need: FacesContext.getCurrentInstance().renderResponse();



I've tried out this hint, but the model always updated when the field is empty. The message displayed in the global messages-tag
instead the associated message-tag.

Is it possible to save the state of the diplayed page with saveState() and when validation fails to restore it? Or is this approach oversized for this task?



Thanks
Joerg



Reply via email to