You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Bode, Bianca" <bi...@hp.com> on 2006/05/22 17:21:15 UTC

Contrib:Table using TextFields: form submit not as expected

Hi all,

I am using a Table component on my page, displaying a list of simple Box
objects, which all contain a property called 'weight'.
I want to be able to change these weight fields so I created the
following:

.html
<form jwcid="page@Form">
<tbody id="boxesList" jwcid="boxesTable">
<span jwcid="weightColumnValue">
<input jwcid="boxWeight" cols="4" size="4" maxlength="4"/>
</span>
</form>

.page
<component id="boxesTable" type="Contrib:Table">
        <binding name="source" value="boxInfo.boxes"/>
        <binding name="columns" value="literal:weight"/>  
</component>
<component id="weightColumnValue" type="Block"/>
    <component id="boxWeight" type="TextField">
        <binding name="value"
value="components.boxesTable.tableRow.weight"/>        
</component>


The id/name attributes of the generated TextFields  are unique;
boxweight, boxweight_0, boxweight_1 etc...

When I first arrive at this page I have 0 boxes, so the table will be
empty.
On the form you can add boxes with a call to a listener, which creates
the Boxes and adds them to the List in BoxInfo.
Then it simply returns the page.

The page in turn, correctly displays the weight fields for the added
Boxes.
Now when I enter values in these fields and submit the form, only the
weight property of the first Box in the List will be updated, strangely
enough with the value entered for the last Box...
Then, when I enter values again, in the two textfields which should have
been displaying the values i entered before submitting the form, and
submit the form for the second time, the second Box gets updated as
well....and so on...so after each form submission one extra Box weight
field will be updated...

Hope this story makes any sense :)

Does this sound familiar to anyone.
Anyone who can help me?

Thanks in advance,
Bianca.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org