On 10/6/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> you cannot. HTML doesn't support array/dict style thing, only flat
> names. That is, you need to name them when generating the HTML with
> something like a_1,a_2 then do the reverse thing when received the form
> data.
>
> I think JSON is a better solution for this. Just have js that loop
> through the table tree(on submit) and grab the contents then construct
> a using MochiKit's JSONSerialize and put that into some "textarea"
> field. On the receiving end, unpack them back into list/dict. This way,
> the fields in individual rows don't need unique id/name.
Or just do this (add error checking, of course):
<tr py:for="item in items">
<td><input type="text" name="product_${item.id}" value="${item.product"}></td>
[etc]
</tr>
Then in your controller:
def formHandler(invoiceId, **kwargs):
for item in Invoice.get(invoiceId).items:
item.product = kwargs['product_' + str(item.id)]
etc.
--
Tim Lesher <[EMAIL PROTECTED]>