[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: Struggling with Ajax
From:       Josh Canfield <joshcanfield () gmail ! com>
Date:       2011-06-30 17:06:36
Message-ID: BANLkTimznOC1j5CE4H3t2B0vG-H17_JFnQ () mail ! gmail ! com
[Download RAW message or body]

> By moving the textfield outside the zone, I managed to avoid the error on zone \
> redisplay.. I still can't seem to pass a value into the component when I click the \
> action link..

You aren't getting the value because you aren't posting the form. Your
"newAlias" context is going to populate the link with whatever the
value of newAlias is at the time the link renders.

I'm not aware of a packaged solution for what you are trying to do
(doesn't mean someone else isn't going to post it as soon as I send
this...)

I've done something like this in the past:

<t:eventlink t:event="add" t:context="['__VALUE__']">Update</t:eventlink>

Then manually bind the link to the zone (copy linkZone function) and
instead of using the link href directly do a replace on it for the
__VALUE__

Josh

On Thu, Jun 30, 2011 at 8:05 AM, Tony Nelson <tnelson@starpoint.com> wrote:
> By moving the textfield outside the zone, I managed to avoid the error on zone \
> redisplay.. I still can't seem to pass a value into the component when I click the \
> action link.. 
> 
> On Jun 30, 2011, at 11:00 AM, Tony Nelson wrote:
> 
> > I'm trying to build a simple component that will be used on 2 pages.  It seems \
> > like it should be simple enough. 
> > I want an unordered list of existing items, a text field that I can type a new \
> > name in, and then a link/button that adds the new name to the list. 
> > The component will be used in the context of an existing form.. so the main tml \
> > looks like: 
> > <form t:id="...">
> > [normal form inputs]
> > 
> > <t:mycomponent />
> > </form>
> > 
> > My current attempt at the component looks like this:
> > 
> > <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
> > xmlns:p="tapestry:parameter">
> > 
> > <fieldset>
> > <legend>Email Aliases</legend>
> > 
> > <t:zone t:id="aliasZone" id="aliasZone">
> > <t:forminjector t:id="aliasFormInjector" position="below">
> > <ul>
> > <t:loop source="allAliases" value="emailAlias">
> > <li>${emailAlias.alias}</li>
> > </t:loop>
> > </ul>
> > <t:textfield id="newAlias" value="newAlias" />
> > </t:forminjector>
> > </t:zone>
> > 
> > <p>
> > <t:actionlink t:id="addAlias" zone="aliasZone" t:context="newAlias">Add \
> > Alias</t:actionlink> </p>
> > 
> > </fieldset>
> > </t:container>
> > 
> > 
> > I'm struggling with 2 problems at the moment.
> > 
> > I can't figure out how to get the value of "newAlias" to be submitted with \
> > actionLink. 
> > When the zone does render after the action submit I get an error because the zone \
> > doesn't  have a form context.  The forminjector above is my current attempt at \
> > solving it, but that yields this error: 
> > org.apache.tapestry5.ioc.internal.util.TapestryException: No object of type \
> > org.apache.tapestry5.services.FormSupport is available from the Environment.  \
> > Available types are org.apache.tapestry5.RenderSupport, \
> > org.apache.tapestry5.ValidationDecorator, \
> > org.apache.tapestry5.internal.services.DocumentLinker, \
> > org.apache.tapestry5.services.ClientBehaviorSupport, \
> > org.apache.tapestry5.services.Heartbeat, \
> > org.apache.tapestry5.services.javascript.JavaScriptSupport. [at \
> > classpath:com/starpoint/helpdesk/components/emailuser/EmailAliasEditor.tml, line \
> > 8] 
> > I've tried to google it but I can't figure out what is really expected.
> > 
> > I've seen a lot of examples where the add button adds a whole new empty row which \
> > is fine, but for a simple input it feels more natural to provide the value and \
> > hit the add button. 
> > After I get this working, I intend on adding a delete button as well..
> > 
> > And then Save action will be handled by the enclosing page and persist all of the \
> > changes include the changes to the component at once. 
> > I've tried using the ajaxloop as well, but I didn't seem to get much further.
> > 
> > Any hints or ideas would be greatly appreciated.
> > 
> > Thanks
> > Tony Nelson
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic