Ok, so I'm not using the right pattern here then. I'm curious about how I should approach my problem:
I have a recurring form pattern in my application, where I need a list of checkable items as part of a form. The code for viewing it and retrieving the checked values on submit is common. If this is a component, I only need to specify the list of objects to be used. But if it is a component, it should handle its own PrimaryKeyEncoder, which needs to be initialized both on setupRender and on form onPrepare. Without hooks to form events, this can't be done. I also should mention that I'm a bit shaky about loops in forms in Tapestry 5, I'm learning as we speak. Maybe I'm stupid, but form loops have been a big stumbling point in both the adoption of T4 and T5 in our application. This time around, I've spent a couple of days trying to make my listener method get the correctly updated values from my loop in the tml. With T4, I often ended up just session persisting the source of loops, because it was the only way to ensure that it "just worked" on submit. This time, I won't do that... In Jumpstart, the example tells me to put the initializing code for the loop source collection and its PrimaryKeyEncoder in the onPrepare event handler. Is this the recommended best practice? Are there other nice approaches to this? Thanks for putting up with all of us stupid users, Tapestry people :) Regards Inge On Fri, Feb 13, 2009 at 1:59 AM, Howard Lewis Ship <hls...@gmail.com> wrote: > On Thu, Feb 12, 2009 at 3:05 AM, Inge Solvoll <inge.tapes...@gmail.com> > wrote: > > Hi! > > > > I have a component that needs to listen to events from a form that > resides > > in the containing page. The component takes care of viewing a list of > > selectable items, and this list and its PrimaryKeyEncoder needs to be > > initialized through the prepare event of the containing form. > > > > In my mind, it seems perfectly logical that form events like PREPARE and > > SUBMIT would trigger methods (onPrepare, onSubmit) in components inside > the > > form component on the page. But in my setup now, only the onPrepare and > > onSubmit methods of the page is called. > > > > Where am I getting this wrong? Aren't components supposed to get access > to > > form events from their containers? > > Events propogate up, not down. So the events are triggered by the > Form, and move up to its container (the page). > > > > > Regards > > > > Inge > > > > > > -- > Howard M. Lewis Ship > > Creator Apache Tapestry and Apache HiveMind > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >