Thank you, Vangel, That`s exactly the case! I`ll have a look at the docs you provided and have a go at it.
The only doubt I still have is whether the <t:selectObject ... > tag is supposed to work nested inside the <t:beaneditform ...> tag. Thanks. I`ll provide feedback as soon as I get to experiment with your suggestion. Eric On Sat, Aug 6, 2011 at 11:01 AM, Vangel V. Ajanovski <a...@ii.edu.mk> wrote: > On 08/06/2011 02:54 PM, Eric Torti wrote: > >> Thank you, based2. >> >> I am following the jumpstart examples. But in my case, the property I need >> to choose from a t:select is not an enum. It`s a complex type. >> > Official documentation has the easiest way if your situation is not very > complex. > https://tapestry.apache.org/**using-select-with-a-list.html<https://tapestry.apache.org/using-select-with-a-list.html> > > For more complex cases (in fact always) I use this component: > https://wiki.apache.org/**tapestry/Tapestry5SelectObject<https://wiki.apache.org/tapestry/Tapestry5SelectObject> > > I have added few modifications to it so that it will work even more > generic. > > For your example with my modification, the component can be used like this: > <t:selectObject > t:id="selectProduct" > list="productList" > value="selectedProduct" > labelField="literal:**productName '\s-\s' price '\s-\s' category.name" > keyField="literal:productId" > /> > > What it will do? > > For example, let's say that "Products" is a database @Entity and if you > have "@Property List<Product> productList" in the background java, and you > have "productName" and "price" in each Product, and you have a "@ManyToOne" > link to Category (also an @Entity) and you have "name" in "Category". > > The select list will look like this (look into the labelField) > LG LC51 - $500 - TV > Nokia E71 - $100 - Mobile > > And the behind html values linked to each element will be taken from the > primary key of Product (look into keyField). > > If this is what you want to do, I can send you the code with full > modification (our subversion host is down at the moment). Maybe I should > post these modifications on the Wiki, but there were some comments that in > general this is not a very good approach. > >