From: Mary J. B. <mar...@io...> - 2006-10-04 10:46:22
|
Hi again, Another question which should be fairly simple to answer. I am trying to carry out a fairly word query within my spyce code and am not sure how to do it. The sql that I want to translate to sqlalchemy is select * from timetable where course='LAA' or course='COM' order by day, starttime. I have tried several times to do this but I get errors trying to do both the order by and the where clauses. Any help will be gratefully received. Thank you all for your help and suggestions. The login token problem is now fixed and I have at the moment decided to use the example on the spyce pages to help with the displaying of different pages for different users. Thanks again, MJ |
From: Jonathan E. <jon...@ca...> - 2006-10-05 15:24:06
|
from sqlalchemy import or_ where = or_(db.timetable.c.course=='LAA', db.timetable.c.course=='COM') db.timetable.select(where, order_by=[db.timetable.c.day, db.timetable.c.starttime]) On Wed, 4 Oct 2006 11:50:07 +0100, "Mary Jane Boholst" <mar...@io...> said: > Hi again, > Another question which should be fairly simple to answer. I am trying to > carry > out a fairly word query within my spyce code and am not sure how to do > it. > The sql that I want to translate to sqlalchemy is select * from timetable > where course='LAA' or course='COM' order by day, starttime. > I have tried several times to do this but I get errors trying to do both > the > order by and the where clauses. > Any help will be gratefully received. > Thank you all for your help and suggestions. The login token problem is > now > fixed and I have at the moment decided to use the example on the spyce > pages > to help with the displaying of different pages for different users. > Thanks again, > MJ > > ------------------------------------------------------------------------- > 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 > _______________________________________________ > Spyce-users mailing list > Spy...@li... > https://lists.sourceforge.net/lists/listinfo/spyce-users -- C++ is history repeated as tragedy. Java is history repeated as farce. --Scott McKay |
From: Mary J. B. <Mar...@io...> - 2006-10-06 15:18:33
|
Thank you very much for this very helpful piece of code. I have another question. (Last one for the week, promise!) I am trying to create a button on a page which inserts values from a form into a database. I have defined my handler and created the button but the data does not seem to be committed to the database. I do not get any error messages but checking the database for the data shows that it has not been inserted. The code for my handler is: [[! def insertentry(self, api,day,course,timeslottype,start,end,title,tutor): api.db.timetable.insert(day=day,course=course,timeslottype=timeslottype,starttime=start,endtime=end,title=title,givenbby=tutor) api.db.flush() ]] The code for the button is: <f:submit handler=self.insertentry value="Insert entry" /> From reading around it seems that this should work. Is there something I am missing? Thanks in advance for all help. MJ Jonathan Ellis wrote: > from sqlalchemy import or_ > where = or_(db.timetable.c.course=='LAA', db.timetable.c.course=='COM') > db.timetable.select(where, order_by=[db.timetable.c.day, > db.timetable.c.starttime]) > > On Wed, 4 Oct 2006 11:50:07 +0100, "Mary Jane Boholst" > <mar...@io...> said: > >> Hi again, >> Another question which should be fairly simple to answer. I am trying to >> carry >> out a fairly word query within my spyce code and am not sure how to do >> it. >> The sql that I want to translate to sqlalchemy is select * from timetable >> where course='LAA' or course='COM' order by day, starttime. >> I have tried several times to do this but I get errors trying to do both >> the >> order by and the where clauses. >> Any help will be gratefully received. >> Thank you all for your help and suggestions. The login token problem is >> now >> fixed and I have at the moment decided to use the example on the spyce >> pages >> to help with the displaying of different pages for different users. >> Thanks again, >> MJ >> >> ------------------------------------------------------------------------- >> 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 >> _______________________________________________ >> Spyce-users mailing list >> Spy...@li... >> https://lists.sourceforge.net/lists/listinfo/spyce-users >> |
From: Jonathan E. <jon...@ca...> - 2006-10-06 16:27:16
|
Well, the first step is to make sure the handler is actually getting executed. Put a print statement in there to check. -J On Fri, 06 Oct 2006 16:22:33 +0100, "Mary Jane Boholst" <Mar...@io...> said: > Thank you very much for this very helpful piece of code. > I have another question. (Last one for the week, promise!) I am trying > to create a button on a page which inserts values from a form into a > database. I have defined my handler and created the button but the data > does not seem to be committed to the database. I do not get any error > messages but checking the database for the data shows that it has not > been inserted. > The code for my handler is: > [[! > def insertentry(self, > api,day,course,timeslottype,start,end,title,tutor): > > api.db.timetable.insert(day=day,course=course,timeslottype=timeslottype,starttime=start,endtime=end,title=title,givenbby=tutor) > api.db.flush() > ]] > > The code for the button is: > <f:submit handler=self.insertentry value="Insert entry" /> > From reading around it seems that this should work. Is there something > I am missing? > Thanks in advance for all help. > MJ > Jonathan Ellis wrote: > > from sqlalchemy import or_ > > where = or_(db.timetable.c.course=='LAA', db.timetable.c.course=='COM') > > db.timetable.select(where, order_by=[db.timetable.c.day, > > db.timetable.c.starttime]) > > > > On Wed, 4 Oct 2006 11:50:07 +0100, "Mary Jane Boholst" > > <mar...@io...> said: > > > >> Hi again, > >> Another question which should be fairly simple to answer. I am trying to > >> carry > >> out a fairly word query within my spyce code and am not sure how to do > >> it. > >> The sql that I want to translate to sqlalchemy is select * from timetable > >> where course='LAA' or course='COM' order by day, starttime. > >> I have tried several times to do this but I get errors trying to do both > >> the > >> order by and the where clauses. > >> Any help will be gratefully received. > >> Thank you all for your help and suggestions. The login token problem is > >> now > >> fixed and I have at the moment decided to use the example on the spyce > >> pages > >> to help with the displaying of different pages for different users. > >> Thanks again, > >> MJ > >> > >> ------------------------------------------------------------------------- > >> 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 > >> _______________________________________________ > >> Spyce-users mailing list > >> Spy...@li... > >> https://lists.sourceforge.net/lists/listinfo/spyce-users > >> > > ------------------------------------------------------------------------- > 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 > _______________________________________________ > Spyce-users mailing list > Spy...@li... > https://lists.sourceforge.net/lists/listinfo/spyce-users -- C++ is history repeated as tragedy. Java is history repeated as farce. --Scott McKay |
From: Mary J. B. <Mar...@io...> - 2006-10-10 10:41:19
|
Thanks for this. It seems that the handler was not getting executed. This is fixed now. However, I have discovered a problem with my delete and update handlers. The handlers are being called however the incorrect entry is deleted. I am trying to as you can probably guess allow certain users to update, delete or insert items to a database. In an attempt to allow certain rows of the table to be deleted or updated I have created delete and update buttons. The handlers do not work as intended which is down to the id variable. The id variable is taken from the database and is intended to be used to identify the row to update or delete. However printing the id value reveals that the id of the uppermost row in the table is being used rather than the id of the row from which the button is pressed. Could anyone explain why this is so? Does any one have an idea how I could use this id variable to delete or update all the rows of the table rather than just the uppermost row in the table? Or even just a way in which I can allow the update and deletion of certain rows in a table? I am not sure if what I have just said makes sense, but any help would be useful. Thanks in advance. Regards, MJ Jonathan Ellis wrote: > Well, the first step is to make sure the handler is actually getting > executed. Put a print statement in there to check. > > -J > > On Fri, 06 Oct 2006 16:22:33 +0100, "Mary Jane Boholst" > <Mar...@io...> said: > >> Thank you very much for this very helpful piece of code. >> I have another question. (Last one for the week, promise!) I am trying >> to create a button on a page which inserts values from a form into a >> database. I have defined my handler and created the button but the data >> does not seem to be committed to the database. I do not get any error >> messages but checking the database for the data shows that it has not >> been inserted. >> The code for my handler is: >> [[! >> def insertentry(self, >> api,day,course,timeslottype,start,end,title,tutor): >> >> api.db.timetable.insert(day=day,course=course,timeslottype=timeslottype,starttime=start,endtime=end,title=title,givenbby=tutor) >> api.db.flush() >> ]] >> >> The code for the button is: >> <f:submit handler=self.insertentry value="Insert entry" /> >> From reading around it seems that this should work. Is there something >> I am missing? >> Thanks in advance for all help. >> MJ >> Jonathan Ellis wrote: >> >>> from sqlalchemy import or_ >>> where = or_(db.timetable.c.course=='LAA', db.timetable.c.course=='COM') >>> db.timetable.select(where, order_by=[db.timetable.c.day, >>> db.timetable.c.starttime]) >>> >>> On Wed, 4 Oct 2006 11:50:07 +0100, "Mary Jane Boholst" >>> <mar...@io...> said: >>> >>> >>>> Hi again, >>>> Another question which should be fairly simple to answer. I am trying to >>>> carry >>>> out a fairly word query within my spyce code and am not sure how to do >>>> it. >>>> The sql that I want to translate to sqlalchemy is select * from timetable >>>> where course='LAA' or course='COM' order by day, starttime. >>>> I have tried several times to do this but I get errors trying to do both >>>> the >>>> order by and the where clauses. >>>> Any help will be gratefully received. >>>> Thank you all for your help and suggestions. The login token problem is >>>> now >>>> fixed and I have at the moment decided to use the example on the spyce >>>> pages >>>> to help with the displaying of different pages for different users. >>>> Thanks again, >>>> MJ >>>> >>>> ------------------------------------------------------------------------- >>>> 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 >>>> _______________________________________________ >>>> Spyce-users mailing list >>>> Spy...@li... >>>> https://lists.sourceforge.net/lists/listinfo/spyce-users >>>> >>>> >> ------------------------------------------------------------------------- >> 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 >> _______________________________________________ >> Spyce-users mailing list >> Spy...@li... >> https://lists.sourceforge.net/lists/listinfo/spyce-users >> |
From: Jonathan E. <jon...@ca...> - 2006-10-10 14:10:41
|
Somehow you are not using your loop correctly and everything is getting the same id. On Tue, 10 Oct 2006 11:45:31 +0100, "Mary Jane Boholst" <Mar...@io...> said: > Thanks for this. It seems that the handler was not getting executed. > This is fixed now. However, I have discovered a problem with my delete > and update handlers. The handlers are being called however the incorrect > entry is deleted. I am trying to as you can probably guess allow certain > users to update, delete or insert items to a database. In an attempt to > allow certain rows of the table to be deleted or updated I have created > delete and update buttons. The handlers do not work as intended which is > down to the id variable. The id variable is taken from the database and > is intended to be used to identify the row to update or delete. However > printing the id value reveals that the id of the uppermost row in the > table is being used rather than the id of the row from which the button > is pressed. > Could anyone explain why this is so? Does any one have an idea how I > could use this id variable to delete or update all the rows of the table > rather than just the uppermost row in the table? Or even just a way in > which I can allow the update and deletion of certain rows in a table? > I am not sure if what I have just said makes sense, but any help would > be useful. > Thanks in advance. > Regards, > MJ > Jonathan Ellis wrote: > > Well, the first step is to make sure the handler is actually getting > > executed. Put a print statement in there to check. > > > > -J > > > > On Fri, 06 Oct 2006 16:22:33 +0100, "Mary Jane Boholst" > > <Mar...@io...> said: > > > >> Thank you very much for this very helpful piece of code. > >> I have another question. (Last one for the week, promise!) I am trying > >> to create a button on a page which inserts values from a form into a > >> database. I have defined my handler and created the button but the data > >> does not seem to be committed to the database. I do not get any error > >> messages but checking the database for the data shows that it has not > >> been inserted. > >> The code for my handler is: > >> [[! > >> def insertentry(self, > >> api,day,course,timeslottype,start,end,title,tutor): > >> > >> api.db.timetable.insert(day=day,course=course,timeslottype=timeslottype,starttime=start,endtime=end,title=title,givenbby=tutor) > >> api.db.flush() > >> ]] > >> > >> The code for the button is: > >> <f:submit handler=self.insertentry value="Insert entry" /> > >> From reading around it seems that this should work. Is there something > >> I am missing? > >> Thanks in advance for all help. > >> MJ > >> Jonathan Ellis wrote: > >> > >>> from sqlalchemy import or_ > >>> where = or_(db.timetable.c.course=='LAA', db.timetable.c.course=='COM') > >>> db.timetable.select(where, order_by=[db.timetable.c.day, > >>> db.timetable.c.starttime]) > >>> > >>> On Wed, 4 Oct 2006 11:50:07 +0100, "Mary Jane Boholst" > >>> <mar...@io...> said: > >>> > >>> > >>>> Hi again, > >>>> Another question which should be fairly simple to answer. I am trying to > >>>> carry > >>>> out a fairly word query within my spyce code and am not sure how to do > >>>> it. > >>>> The sql that I want to translate to sqlalchemy is select * from timetable > >>>> where course='LAA' or course='COM' order by day, starttime. > >>>> I have tried several times to do this but I get errors trying to do both > >>>> the > >>>> order by and the where clauses. > >>>> Any help will be gratefully received. > >>>> Thank you all for your help and suggestions. The login token problem is > >>>> now > >>>> fixed and I have at the moment decided to use the example on the spyce > >>>> pages > >>>> to help with the displaying of different pages for different users. > >>>> Thanks again, > >>>> MJ > >>>> > >>>> ------------------------------------------------------------------------- > >>>> 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 > >>>> _______________________________________________ > >>>> Spyce-users mailing list > >>>> Spy...@li... > >>>> https://lists.sourceforge.net/lists/listinfo/spyce-users > >>>> > >>>> > >> ------------------------------------------------------------------------- > >> 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 > >> _______________________________________________ > >> Spyce-users mailing list > >> Spy...@li... > >> https://lists.sourceforge.net/lists/listinfo/spyce-users > >> > > ------------------------------------------------------------------------- > 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 > _______________________________________________ > Spyce-users mailing list > Spy...@li... > https://lists.sourceforge.net/lists/listinfo/spyce-users -- C++ is history repeated as tragedy. Java is history repeated as farce. --Scott McKay |
From: Mary J. B. <mar...@io...> - 2006-10-10 14:53:33
|
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. Thanks again. MJ On Tuesday 10 October 2006 15:10, Jonathan Ellis wrote: > Somehow you are not using your loop correctly and everything is getting > the same id. > > On Tue, 10 Oct 2006 11:45:31 +0100, "Mary Jane Boholst" > > <Mar...@io...> said: > > Thanks for this. It seems that the handler was not getting executed. > > This is fixed now. However, I have discovered a problem with my delete > > and update handlers. The handlers are being called however the incorrect > > entry is deleted. I am trying to as you can probably guess allow certain > > users to update, delete or insert items to a database. In an attempt to > > allow certain rows of the table to be deleted or updated I have created > > delete and update buttons. The handlers do not work as intended which is > > down to the id variable. The id variable is taken from the database and > > is intended to be used to identify the row to update or delete. However > > printing the id value reveals that the id of the uppermost row in the > > table is being used rather than the id of the row from which the button > > is pressed. > > Could anyone explain why this is so? Does any one have an idea how I > > could use this id variable to delete or update all the rows of the table > > rather than just the uppermost row in the table? Or even just a way in > > which I can allow the update and deletion of certain rows in a table? > > I am not sure if what I have just said makes sense, but any help would > > be useful. > > Thanks in advance. > > Regards, > > MJ > > > > Jonathan Ellis wrote: > > > Well, the first step is to make sure the handler is actually getting > > > executed. Put a print statement in there to check. > > > > > > -J > > > > > > On Fri, 06 Oct 2006 16:22:33 +0100, "Mary Jane Boholst" > > > > > > <Mar...@io...> said: > > >> Thank you very much for this very helpful piece of code. > > >> I have another question. (Last one for the week, promise!) I am trying > > >> to create a button on a page which inserts values from a form into a > > >> database. I have defined my handler and created the button but the > > >> data does not seem to be committed to the database. I do not get any > > >> error messages but checking the database for the data shows that it > > >> has not been inserted. > > >> The code for my handler is: > > >> [[! > > >> def insertentry(self, > > >> api,day,course,timeslottype,start,end,title,tutor): > > >> > > >> api.db.timetable.insert(day=day,course=course,timeslottype=timeslottyp > > >>e,starttime=start,endtime=end,title=title,givenbby=tutor) > > >> api.db.flush() > > >> ]] > > >> > > >> The code for the button is: > > >> <f:submit handler=self.insertentry value="Insert entry" /> > > >> From reading around it seems that this should work. Is there > > >> something I am missing? > > >> Thanks in advance for all help. > > >> MJ > > >> > > >> Jonathan Ellis wrote: > > >>> from sqlalchemy import or_ > > >>> where = or_(db.timetable.c.course=='LAA', > > >>> db.timetable.c.course=='COM') db.timetable.select(where, > > >>> order_by=[db.timetable.c.day, > > >>> db.timetable.c.starttime]) > > >>> > > >>> On Wed, 4 Oct 2006 11:50:07 +0100, "Mary Jane Boholst" > > >>> > > >>> <mar...@io...> said: > > >>>> Hi again, > > >>>> Another question which should be fairly simple to answer. I am > > >>>> trying to carry > > >>>> out a fairly word query within my spyce code and am not sure how to > > >>>> do it. > > >>>> The sql that I want to translate to sqlalchemy is select * from > > >>>> timetable where course='LAA' or course='COM' order by day, > > >>>> starttime. I have tried several times to do this but I get errors > > >>>> trying to do both the > > >>>> order by and the where clauses. > > >>>> Any help will be gratefully received. > > >>>> Thank you all for your help and suggestions. The login token problem > > >>>> is now > > >>>> fixed and I have at the moment decided to use the example on the > > >>>> spyce pages > > >>>> to help with the displaying of different pages for different users. > > >>>> Thanks again, > > >>>> MJ > > >>>> > > >>>> -------------------------------------------------------------------- > > >>>>----- 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=D > > >>>>EVDEV _______________________________________________ > > >>>> Spyce-users mailing list > > >>>> Spy...@li... > > >>>> https://lists.sourceforge.net/lists/listinfo/spyce-users > > >> > > >> ---------------------------------------------------------------------- > > >>--- 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=DEV > > >>DEV _______________________________________________ > > >> Spyce-users mailing list > > >> Spy...@li... > > >> https://lists.sourceforge.net/lists/listinfo/spyce-users > > > > ------------------------------------------------------------------------- > > 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 > > _______________________________________________ > > Spyce-users mailing list > > Spy...@li... > > https://lists.sourceforge.net/lists/listinfo/spyce-users |
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 |
From: Mary J. B. <Mar...@io...> - 2006-10-11 08:49:28
|
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" > <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> > [[}]] > > > > |
From: Jonathan E. <jon...@ca...> - 2006-10-11 16:00:10
|
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" <Mar...@io...> 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" > > <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> > > [[}]] > > > > > > > > > > ------------------------------------------------------------------------- > 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 > Spy...@li... > https://lists.sourceforge.net/lists/listinfo/spyce-users -- C++ is history repeated as tragedy. Java is history repeated as farce. --Scott McKay |