Sorry, the java code should be: @Inject @Property private Block _formBlock;
Object onActionFromAddBlock() { // code to add another item to list of items return _formBlock; } On Tue, Apr 1, 2008 at 2:54 PM, Peter Beshai <[EMAIL PROTECTED]> wrote: > I figured it out. Here is an example of my solution: > > <t:zone t:id="outputZone"> > <t:delegate to="formBlock"/> > > <t:block t:id="formBlock"> > <t:form> > <t:errors/> > > <t:loop source="items" value="currentItem"> > <t:textfield value="currentItem.name"/> <t:actionlink > zone="outputZone" t:id="addBlock">+</t:actionlink><br/> > </t:loop> > </t:form> > </t:block> > </t:zone> > > --- > Object onActionFromAddBlock() > { > // code to add another item to list of items > } > > Peter Beshai > > > On Tue, Apr 1, 2008 at 12:54 PM, Peter Beshai <[EMAIL PROTECTED]> > wrote: > > > Problem: > > > > I would like to have a textfield with a button/link beside it that when > > clicked adds an additional textfield with another button beside it. I would > > like this to be done with Ajax, but I am not sure how to have the first > > textfield and button render initially. > > > > I basically have: > > > > <t:zone ...> > > <t:block ...> > > <t:loop ...> > > <t:textfield .../> <t:actionlink ...>...</t:actionlink> > > </t:loop> > > </t:block> > > </t:zone> > > > > > > However, with this approach the block will not be rendered initially > > (you need to fire off the event and have the block returned first) and thus > > there will be no actionlink to click. I'm not sure the way to proceed, but I > > don't think the answer is to just add in a textfield with actionlink outside > > of the block and have an extra event handler method for that actionlink. > > > > > > Any ideas? > > > > Peter Beshai > > > > >