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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to