Re: help creating sqlalchemy/sqlsoup code for sql query
"Jonathan Ellis" <[email protected]> Tue, 10 Oct 2006 13:17:54 -0700
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 10 Oct 2006 15:57:29 +0100, "Mary Jane Boholst" <[email protected]> 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 ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV