|
From: Jonathan E. <jon...@ca...> - 2006-10-10 20:17:56
|
On Tue, 10 Oct 2006 15:57:29 +0100, "Mary Jane Boholst"
<mar...@io...> said:
> When I add the id column to the table which I am displaying, the rows
> have the
> correct id associated with them, however when I try to delete a row the
> first
> row displayed is deleted.
> I attach the relevant code. If anyone could shed light on what is going
> on and
> what I am doing wrong I will be very grateful.
Forms have a single "namespace," every time your loop executes, you
create a hidden variable, but only one of those values is actually used
in the handler. If you want to take that approach, you need a separate
form for each time through the loop.
You can also clean up your loops, you don't need the "r" variable. like
this
[[for item in lists: {]]
<f:form>
<tr>
<td><f:hidden name="item_id" value="=item.id" />
<td><f:text name="item_id" value="=item.id" size =4 /></td>
<td><f:text name="day" value="=item.day" size =2 /></td>
<td><f:text name="course" value="=item.course" size =5 /></td>
<td><f:text name="start" value="=item.starttime" size =5 /></td>
<td><f:text name="end" value="=item.endtime" size =5 /></td>
<td><f:text name="title" value="=item.title" size =80 /></td>
<td><f:text name="tutor" value="=item.givenby" size =30 /></td>
<td><f:submit handler=action.delete value="Delete Entry" /></td>
<td><f:submit handler=action.update value="Update Entry" /></td>
</tr>
</f:form>
[[}]]
--
C++ is history repeated as tragedy. Java is history repeated as farce. --Scott McKay
|