Well, i think i am really screwing thnigs up. Very sorry for abusing of your time, i have almost everything working ok. Thanks for your time!
On Sat, May 17, 2008 at 2:57 PM, Manuel Corrales <[EMAIL PROTECTED]> wrote: > Ok, me bothering again. Now when i have a validation error that was checked > on the server side, the form is completely wiped out. Thats the normal > behavior? > > > On Sat, May 17, 2008 at 2:49 PM, Manuel Corrales <[EMAIL PROTECTED]> > wrote: > >> Sorry, my mistake. The same code i posted but without initializing the >> matafuego variable is working now. I still dont completely understand why >> tapestry is not cleaning my matafuego variable. >> >> Thanks very much for your help! >> >> >> On Sat, May 17, 2008 at 2:39 PM, Manuel Corrales < >> [EMAIL PROTECTED]> wrote: >> >>> Ok, thanks. Probably this is some stupid begginer mistake, but i cant >>> make this work. My class is this: >>> >>> public class NuevoMatafuego { >>> >>> private Matafuego matafuego = new Matafuego(); >>> @Inject >>> private Messages messages; >>> @Component >>> private Form nuevoMatafuegoForm; >>> @Component(id = "nroAparato") >>> private TextField nroAparato; >>> >>> public SelectModel getTiposDeMatafuego() { >>> return new EnumSelectModel(TipoMatafuego.class, messages); >>> } >>> >>> public Matafuego getMatafuego() { >>> return matafuego; >>> } >>> >>> public void setMatafuego(Matafuego matafuego) { >>> this.matafuego = matafuego; >>> } >>> >>> void onActivate() { >>> if (matafuego == null) { >>> matafuego = new Matafuego(); >>> } >>> } >>> >>> @OnEvent(value = "submit", component = "nuevoMatafuegoForm") >>> Object onSubmitNuevoMatafuegoForm() { >>> MatafuegoFacade facade = new MatafuegoFacade(); >>> try { >>> facade.guardarMatafuego(matafuego); >>> matafuego = null; >>> return MainMatafuegos.class; >>> } catch ( ConstraintViolationException e) { >>> nuevoMatafuegoForm.recordError(nroAparato, >>> messages.get("matafuegoDuplicado")); >>> return this; >>> } >>> } >>> >>> } >>> >>> >>> As you can see, the matafuego instance is not @Persist, so i really do >>> not undestand why is not being cleared. Also if instead of doing Matafuego >>> matafuego = new Matafuego(); on the declaration, i dont initialize it, then >>> when i try to save it, it is null in the onSubmit method. >>> >>> Any suggestion? >>> >>> >>> On Sat, May 17, 2008 at 1:51 PM, Kevin Menard <[EMAIL PROTECTED]> >>> wrote: >>> >>>> It doesn't really matter where you clear it. Just clear it when you're >>>> done >>>> with it. As for the lifecycle question, you have to clear it because >>>> you >>>> @Persisted it. If you didn't @Persist it, you wouldn't have to clear >>>> it, >>>> but you'd likely lose your data when working with the form, depending on >>>> your workflow. >>>> >>>> This should work fine. I do it all the time. >>>> >>>> -- >>>> Kevin >>>> >>>> >>>> On 5/17/08 12:34 PM, "Manuel Corrales" <[EMAIL PROTECTED]> >>>> wrote: >>>> >>>> > Hi Ned, the onSuccess methos is executed before the onSubmit, so that >>>> would >>>> > not work for me because i am doing the model logic on the onSubmit. I >>>> tryed >>>> > setting my variable in null after executing my businnes logic, but i >>>> still >>>> > have the same issue. My private variable should not be cleaned by >>>> Tapestry >>>> > pooling mechanism? >>>> > >>>> > The only thing i can think to fix this, is to set my variable to null >>>> after >>>> > the bussines logic, and then on the onACtivate method check if its >>>> null, the >>>> > i create a new one, if its not null then i do nothing. >>>> > >>>> > Thanks, and still waiting for an elegant solution to this ;) >>>> > ** >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>>> >>> >> >