Thanks Carsten and Jonathan, I really appreciate the input... As usual, I made this harder than it needed to be. I have a business requirement to fufill which is why I had to do it this way.
I got it working... In my page class I have: public User getGroupUser(){ return groupMap.get(group); } public void setGroupUser(User user){ groupMap.put(group, user); } Group gets unwound in the loop. When you are displaying the data form tapestry loops through all the values updating each select component with the value of each coresponding group. When u submit the form it does the same thing via setGroupUser in reverse. TML for anyone who cares: <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"> <body> <h1>Edit User</h1> <t:form> <t:errors/> <table> <tr> <td colspan="2"> <label>Group</label> </td> </tr> <t:loop source="salesGroups" value="group" element="tr"> <td><t:label for="GroupName">${group.groupName}</t:label></td> <td><t:select t:id="GroupName" model="userModel" value="GroupUser" /></td> </t:loop> </table> <p> <input type="submit" value="Update"/> </p> </t:form> </html> Thanks again! -Russell ________________________________ From: Jonathan Barker <jonathan.theit...@gmail.com> To: Tapestry users <users@tapestry.apache.org>; carsten.kl...@axn-software.de Sent: Tuesday, July 24, 2012 10:43 AM Subject: Re: Updating a size 20 map with On Change event of 20 select components Actually, the built-in select component will handle option groups, but you need to provide a custom SelectModel. On Mon, Jul 23, 2012 at 3:13 PM, Carsten Klein <carsten.kl...@axn-software.de> wrote: > This should have gone to the mailing list so I will repost it here: > > > Hi Russell, > > see http://tapestry.apache.org/using-select-with-a-list.html for a > thorough explanation on how to do this. > > The problem I see in your approach is that you a an arbitrary number of > select components having the same name. Perhaps you should try and make > this a single component instead, where the group names are used for > grouping individual options, namely the users that belong to that group. > > E.g. > > Morgue Accessoires Sales Dep > John Doe > Frank Stein > Liquor Sales Dep > George Doubleu > John Wayne > > This is also supported by the HTML select element, using option groups. > > And, considering that this will render a single select element instead of > twenty, this will increase overall useability a lot. > > The standard select component does not support this, but you can always > extend upon that behaviour and implement your own custom component. > > Cheers > -- Carsten > >> I am trying to wrap my head around how to do this in tapestry. >> >> I have a form with 20 select components that are created with the loop >> component. >> >> Given a Map<Group, User> groupMap... >> >> Each select component's value (user) is a value in the map. >> >> Each label (group) for each select is the key of the map >> >> when a select components value has been changed, I want to update the map >> with it value. >> >> I understand that if this was just one select component I could just say >> something like OnChangeFromSelectID or a zone. >> >> But I'm trying to understand how to do this with 20 select components: >> >> TML: >> <table> >> >> <tr> >> <td colspan="2"> >> <label>Group</label> >> </td> >> </tr> >> <t:loop source="salesGroups" value="group" element="tr"> >> <td><t:label for="GroupName">${group.groupName}</t:label></td> >> <td><t:select t:id="GroupName" model="userModel" >> value="GroupUser" /></td> >> </t:loop> >> </table> >> >> PAGE CLASS?: >> public Object onGroupNameChange(User user) >> { >> groupMap.put(group, recipient); >> } >> >> >> I'm still new but i'm starting to get the hang of T5... >> Thanks! >> -Russell > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > -- Jonathan Barker ITStrategic --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org