You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jim Tomlinson <ji...@u.washington.edu> on 2008/08/14 02:00:01 UTC
T5: Specify List as Form's context?
I'm vapor-locking on how to specify a List of values in a Form
component's context parameter. In this form:
<form t:type="form" t:id="updateForm" t:context="${foo}, ${bar}">
Tapestry correctly calls my 'String getFoo()' and 'Long getBar()'
methods when preparing to render (let's say they return "fooString" and
1L respectively), but my onPrepare... doesn't get called correctly with
the resulting values as a List. If I declare
onPrepareFromUpdateForm(String bothVals)
I get the String: "fooString, 1"
If I declare it as
onPrepareFromUpdateForm(String fooVal, long barVal)
the onPrepare... method doesn't get called at all. What's the magic to
correctly constructing the context parameter as a List (which the docs
say is possible). Thanks.
--
------------- UW Office of Information Management -------------
Jim Tomlinson Office: (206) 685-6449
Sr Applications System Engineer University of Washington
-------------------- Rome Development Team --------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Specify List as Form's context?
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,
Either assemble the list in a method of your page class or use the list
binding prefix from the wiki.
http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefix
-Filip
On 2008-08-14 02:00, Jim Tomlinson wrote:
> I'm vapor-locking on how to specify a List of values in a Form
> component's context parameter. In this form:
>
> <form t:type="form" t:id="updateForm" t:context="${foo}, ${bar}">
>
> Tapestry correctly calls my 'String getFoo()' and 'Long getBar()'
> methods when preparing to render (let's say they return "fooString" and
> 1L respectively), but my onPrepare... doesn't get called correctly with
> the resulting values as a List. If I declare
>
> onPrepareFromUpdateForm(String bothVals)
>
> I get the String: "fooString, 1"
>
> If I declare it as
>
> onPrepareFromUpdateForm(String fooVal, long barVal)
>
> the onPrepare... method doesn't get called at all. What's the magic to
> correctly constructing the context parameter as a List (which the docs
> say is possible). Thanks.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Specify List as Form's context?
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 13 Aug 2008 21:00:01 -0300, Jim Tomlinson <ji...@u.washington.edu>
escreveu:
> I'm vapor-locking on how to specify a List of values in a Form
> component's context parameter. In this form:
>
> <form t:type="form" t:id="updateForm" t:context="${foo}, ${bar}">
Try this instead:
<form t:type="form" t:id="updateForm" t:context="context">
public List getContext() {
List list = new ArrayList();
list.add(getFoo());
list.add(getBar());
return list;
}
> the onPrepare... method doesn't get called at all. What's the magic to
> correctly constructing the context parameter as a List (which the docs
> say is possible). Thanks.
The magic :) is remembering that ${} property expansions turns the values
into Strings. You shouldn't use them for component parameters (at least
97% of the time).
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org