By making it @Persist (i.e. with default), then the container (i.e., your page) can set a @Meta to control the default persistence of components below it. Thus, if you want the default to be "flash", you're in luck. Or, you can inject the Form component, it has methods that overlap ValidationDelegate for clearing errors & etc. (it just delegates to its ValidationDelegate).
On 8/3/07, Christian Koeberl <[EMAIL PROTECTED]> wrote: > > Hi! > > I was wondering why the "_defaultTracker" in the Form component is marked > as @Persist not as @Persist("flash"). > > In my opinion it should be @Persist("flash")!! > > Persisting the ValidationTracker in the session leads to some (usually) > not wanted > behaviour: the validation is not reset, even though a new object is edited > with that form. > > Here is an example: > > Assume you have a page with a form and a TextField. I disabled client > validation to > see the problem: > > @SuppressWarnings("unused") > @Component(parameters = "clientValidation = false") > private Form mainForm; > > @SuppressWarnings("unused") > @Component(parameters = > { "value = name", "label = literal:Name", "validate = required, > maxlength=20" }) > private TextField nameField; > > private String name; > // getters and setters > > When you try to save the form the ValidationTracker tracks the error and > the error > is displayed to the user. So far, so good. > Next, the user triggers a PageLink ("Cancel edit") to another page. There > the user > selects another name and is forwarded to the page with the form again, the > new name > is set with setName("xxx"). The form still displays the error and the old > value of the > previously edited name. > > -- > Chris > -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com