You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Manuel Corrales <ma...@gmail.com> on 2008/05/19 15:36:34 UTC

Form with errors

Hi, i have a left menu with a link (Add new Item). When i press the link, i
go to a form to create a new Item. If i have some server side validation
error, the error messages are shown on the screen, but the issue is that if
i press the Add new Item from the left menu, the form does not clean itself,
i mean the errors are still there and the form have the values i was
entering. Is this the right behavior? How can i do to get a new clean form
each time i press the link?

Thanks in advance!

Re: Form with errors

Posted by ningdh <ni...@gmail.com>.
Hi

1. For error message: My practice is to clean the form in page's cleanupRender phase.
Page.java
@Component
    private Form form;
void cleanupRender() {
        form.clearErrors();// clear error message
    }

After then, if you reenter the page, error message would be gone.

2. For form value still exists: I think you have persist your model, right? So it is persisted in Session by default.

Hope that helps.

Thanks!
DH

----- Original Message ----- 
From: "Manuel Corrales" <ma...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Monday, May 19, 2008 9:36 PM
Subject: Form with errors


> Hi, i have a left menu with a link (Add new Item). When i press the link, i
> go to a form to create a new Item. If i have some server side validation
> error, the error messages are shown on the screen, but the issue is that if
> i press the Add new Item from the left menu, the form does not clean itself,
> i mean the errors are still there and the form have the values i was
> entering. Is this the right behavior? How can i do to get a new clean form
> each time i press the link?
> 
> Thanks in advance!
>