[prev in list] [next in list] [prev in thread] [next in thread]
List: tapestry-user
Subject: Tapestry 4: form with dynamic checkboxes
From: Ryan <rnideffer () gmail ! com>
Date: 2014-01-31 18:41:46
Message-ID: CAA86+=riQUSexemONivZJ0VNcuHo4mRSC2ZneU5VdOoYb9Mwsw () mail ! gmail ! com
[Download RAW message or body]
Hoping I can still get some help with Tapestry 4 on this mailing list - I
know its old but unfortunately I'm stuck with it and cannot upgrade at this
time.
I've got a form containing a table with two columns. The table is
constructed using contrib:TableView and the source paramter is a
Map<String,Object>. This map is dynamically created each time the page
renders and contains three keys:
- id (int)
- name (string)
- checked (boolean)
Here is the form:
<form jwcid="addRegion@Form">
<span jwcid="@Hidden" value="ognl:id"/>
<span jwcid="@Hidden" value="ognl:name"/>
<table class="form">
<tr>
<th>Name</th>
<td><input jwcid="@TextField" displayName="Name"
value="ognl:newRegion.name" size="40"/></td>
</tr>
<tr>
<td></td>
<td align="right">
<input type="submit" jwcid="add@Submit" label="Add
Region" class="button" listener="listener:doAdd" parameters="ognl:{id,name
}"/>
</td>
</tr>
</table>
<table jwcid="sitesTable@contrib:TableView" pageSize="25"
width="100%" class="header" source="ognl:availableSites" columns="Site
Name:description">
<tr>
<td jwcid="@contrib:TableColumns" class="header"/>
</tr>
<tr jwcid="@contrib:TableRows" row="ognl:site"
class="ognl:beans.evenOdd.next">
<td jwcid="@contrib:TableValues" align="left"
class="cute"/>
<td align="left">
<input type="checkbox" jwcid="@Checkbox"
id="ognl:'checked_' + site.id" value="ognl:site.checked"/>
</td>
</tr>
</table>
</form>
This form and enclosed table render properly, however the part I'm stuck on
is how to determine that 'checked_<id>' is true. I have never been clear on
exactly how the TableRow object needs to be wired, but I have included this
method in my backing class:
public abstract Map<String,Object> getSite();
but neither the Map returned by this method nor the Map in 'availableSites'
has the 'checked' property set to True when I try to determine it within my
doAdd() method.
From what I understand of Tapestry4 and the form component, the checkbox
'value' is the property that is inspected on read and set on post, which
means it must map to a concrete, defined method or property. I can't do
that since I'm determining the items in the map dynamically.
What do you suggest?
Thanks,
Ryan
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic