Re: help creating sqlalchemy/sqlsoup code for sql query

"Jonathan Ellis" <[email protected]> Wed, 11 Oct 2006 09:00:10 -0700
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
No, a form is not the same as a page.  A form is a group of inputs on a
page that get submitted together.  You can have many forms in a page as
I did in the code I gave.

Another alternative is to have a single form for managing things
(adding, deleting, selecting items) and another (on a different page)
for editing a single old or new item.  Personally I think this is
cleaner but there's nothing wrong with the many-forms approach for
something quick-and-dirty.

-Jonathan

On Wed, 11 Oct 2006 09:53:46 +0100, "Mary Jane Boholst"
<[email protected]> said:
> Thank you for shedding some light on what is happening. However I am 
> still a little confused. Does that mean that I need to display a 
> separate page for each row of the table in order to have a delete and 
> update button associated with the row? What other way/s would you 
> suggest of doing the same thing?
> Thanks very much, sorry to keep bothering you.
> MJ
> 
> Jonathan Ellis wrote:
> > 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>
> > [[}]]
> >
> >
> >
> >   
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Spyce-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/spyce-users
-- 
C++ is history repeated as tragedy. Java is history repeated as farce.  --Scott McKay


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642