You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Beshai <pe...@gmail.com> on 2008/04/01 18:54:08 UTC

[T5] Get Zone to Initially Render a Block

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

[T5]:addScriptLink with parameter

Posted by "Zheng, Xiahong" <Xi...@FMR.COM>.
Using addScriptLink() can only project <script type="text/javascript"
src="dojo/dojo.js"/>

I am wondering if it's possible to produce a script link like the
following,

    <script type="text/javascript" src="dojo/dojo.js" 
      djConfig="parseOnLoad: true"></script>

I am trying to write some T5 component using dojo which uses "djConfig"
paramenter.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] Get Zone to Initially Render a Block

Posted by Peter Beshai <pe...@gmail.com>.
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 <pe...@gmail.com> 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 <pe...@gmail.com>
> 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
> >
> >
>

Re: [T5] Get Zone to Initially Render a Block

Posted by Peter Beshai <pe...@gmail.com>.
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 <pe...@gmail.com>
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
>
>