Has anyone tried this with a component in a form fragment ? On Tue, Aug 23, 2011 at 7:43 PM, Josh Canfield <joshcanfi...@gmail.com>wrote:
> > I wonder how a component can participate on > > form events (especially onSubmit) which would give me a chance to "set > back" > > the values in my model. > > I would treat your aggregate components the same way the basic > textfield classes work. You can either pass the model and have it > update the model properties directly, or you can pass surrogate values > that are placed into the model in onSuccess. > > <t:newsLetterEditor model="model"/> > or > <t:newsLetterEditor newsletter="model.newsletter"/> > to update the model directly: > > or > <t:newsLetterEditor newsletter="temporaryNewsletterHolder"/> > to modify a surrogate that is used to modify the model in onSuccess. > > > FormSupport has some methods that could help. > > For your aggregate component which takes breaks apart a String into > booleans, consider using FormSupport#store in your AfterRender method. > > This puts an object in the form that gets executed during the form > submission. Putting it in AfterRender means that your embedded text > fields will get put in the action stack first. When your action is run > these fields will have updated their values and you can re-constitute > your string. > > Look at AbstractField for an example. > > > Josh > > > On Mon, Aug 22, 2011 at 1:26 PM, Jens Breitenstein <mailingl...@j-b-s.de> > wrote: > > Hi Robert! > > > > I have a hugh and complex form and tried to create components and cut > down > > the page code. Each component gets access to the model by a parameter > and in > > setupRender each component extracts the relevant data and adjusts the > visual > > elements like text / checkbox accordingly to reflect the state which just > > works perfect. Furthermore this opens the door to dynamically show > different > > components (other visual elements like dropdown instead of list of radio > > btns) without touching the page any longer (more or less). > > > > So I achieved the first half. I wonder how a component can participate on > > form events (especially onSubmit) which would give me a chance to "set > back" > > the values in my model. This is more or less full OO as the component is > > responsible for displaying info from a model and updating the model and > the > > page becomes just a container for components without "transfer" logic. > This > > would allow me to reuse my componts much easier. > > > > I can use @property(write = false) and add a setter to keep track of the > > input values of each component element, but to me it feels just wrong as > I > > depend on many single set calls instead of one submit method which > clearly > > indicates it's sole purpose on a page. > > > > > > Jens > > > > > > > > Am 22.08.11 22:10, schrieb Robert Zeigler: > >> > >> No. Events bubble up, so if you have: > >> > >> <t:form> > >> <t:somecomponent> > >> </t:form> > >> > >> The form can "see" the events from somecomponent, and the page will see > >> events from form and somecomponent, but somecomponent won't see the > form's > >> event. > >> > >> What are you trying to accomplish? > >> > >> Robert > >> > >> On Aug 22, 2011, at 8/223:04 PM , Jens Breitenstein wrote: > >> > >>> Hi all! > >>> > >>> is it possible for a component to listen to the "success" event from > the > >>> enclosing form? > >>> I tried various onEvent combinations but my annotated component method > is > >>> never called... > >>> > >>> > >>> Jens > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >>> For additional commands, e-mail: users-h...@tapestry.apache.org > >>> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >> For additional commands, e-mail: users-h...@tapestry.apache.org > >> > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- *Regards,* *Muhammad Gelbana Java Developer*