Ok, I found that this can be achieved using a Submit Notifier. @OnEvent(value = "BeginSubmit") public void setupForSubmit() { final List<String> paramNames = request.getParameterNames(); selectedItem = new HashMap<Integer, Item>(); for (String paramName : paramNames) { if (paramName.startsWith("myItemSelectField")) { final Item item = getItemValueEncoder().toValue(request.getParameter(paramName)); if (item != null) { selectedItem.put(item.getId(), item); } } } }
It's not exactly a very elegant solution. If this component was used several times in a page inside different FormFragments, this wouldn't exactly work. Request params would include params that are for versions of the component that is inside a hidden FormFragment. Any better solutions? ----- Original Message ---- From: Dave Greggory <davegregg...@yahoo.com> To: Tapestry users <users@tapestry.apache.org> Sent: Friday, February 13, 2009 7:15:49 PM Subject: [T5] How to have a N number of select fields in a form In spring MVC, I would do the following, <c:forEach items="myList" value="myItem"> <form:select path="myMap[myItem.name]" items="${myItem.values}"/> </c:forEach> How do I do the same in Tapestry? I tried the following, but obvisously it didn't work because the Select field is not capable of setting a value in a map. @Component (parameters = {"source=myList", "value=myItem", "encoder=itemPrimaryKeyEncoder", "index=index"}) private Loop myListLoop; @Component (parameters = { "model=itemSelectModel", "encoder=itemValueEncoder", "value=selectedItem[index]"}) private Select myItemSelectField; @Property private int index; @Property private Item myItem; @Property private Map<Integer, Item> selectedItem = new HashMap<Integer, Item>(); I took a look at the sources of AjaxFormLoop and also PagedLoop in Chenille Kit, but I couldn't figure it out. Any thoughts? Dave --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org