redirection from within forms with submit button
Hello, The idea is to call a method to display an image from a certain date (eg 1796/03/11) en get the n-th (eg 5-th) image for that particular day.
From there i want to be able to page to Next and Previous, which is in effect a traversal in batches of one. This works if in the method <toondecr> I use links like these:
<td align=right valign="top" width="100%"> <dtml-if next-sequence> <dtml-in expr="decrQuery(datum=(_.str(datum)))" next size=1 orphan=1 start=teller> <a href="<dtml-var URL><dtml-var sequence-query >teller=<dtml-var next-sequence-start-number>"> volgend image </a> </dtml-in> </dtml-if next-sequence> </td></tr></table> But i would like to be able to use submit buttons. The following works from a separate method (which only consists of the following): <form method="post" action=""> <input type="submit" name="x" value="> "> <dtml-if x> <dtml-call "REQUEST.set('datum', _.str('1796/03/11'))"> <dtml-call "REQUEST.set('teller', 5)"> <input type="hidden" name="" value="<dtml-call "RESPONSE.redirect('toondecr2?datum=%s&teller=%s' % (datum,teller))">"> </dtml-if> </form> but it doesn't work from within the method <toondecr>, which is the standard method for displaying the images. Preferably the redirection would point to <toondecr> itself, but even pointing to an almost identical method <toondecr2> won't work. I get an error message: Error Type: NameError, Error Value: datum. The dtml-var <datum> nevertheless is callable even ín the form itself. For completeness sake, the essential listing apart from the Next and Previous links for the method toondecr is: <dtml-in "decrQuery(_.None, _, datum=(_.str(datum)))" size=1 start=teller> <img src="<dtml-var imagenaam>.gif"> </dtml-in> Anybody any idea? Cheers, Dirk
Must admit I cant be bothered to read all this but some notes: <input type="hidden" name="" value="<dtml-call "RESPONSE.redirect('toondecr2?datum=%s&teller=%s' % (datum,teller))">"> This is pointless, the page will never be rendered because it will instantly do the redirect. If you could refactor this a bit to more concise question... ----- Original Message ----- From: "Dirk Van.Laanen" <Dirk.Van.Laanen@niwi.knaw.nl> To: <zope@zope.org> Sent: Wednesday, March 27, 2002 12:25 AM Subject: [Zope] redirection from within forms with submit button Hello, The idea is to call a method to display an image from a certain date (eg 1796/03/11) en get the n-th (eg 5-th) image for that particular day.
From there i want to be able to page to Next and Previous, which is in effect a traversal in batches of one. This works if in the method <toondecr> I use links like these:
<td align=right valign="top" width="100%"> <dtml-if next-sequence> <dtml-in expr="decrQuery(datum=(_.str(datum)))" next size=1 orphan=1 start=teller> <a href="<dtml-var URL><dtml-var sequence-query >teller=<dtml-var next-sequence-start-number>"> volgend image </a> </dtml-in> </dtml-if next-sequence> </td></tr></table> But i would like to be able to use submit buttons. The following works from a separate method (which only consists of the following): <form method="post" action=""> <input type="submit" name="x" value="> "> <dtml-if x> <dtml-call "REQUEST.set('datum', _.str('1796/03/11'))"> <dtml-call "REQUEST.set('teller', 5)"> <input type="hidden" name="" value="<dtml-call "RESPONSE.redirect('toondecr2?datum=%s&teller=%s' % (datum,teller))">"> </dtml-if> </form> but it doesn't work from within the method <toondecr>, which is the standard method for displaying the images. Preferably the redirection would point to <toondecr> itself, but even pointing to an almost identical method <toondecr2> won't work. I get an error message: Error Type: NameError, Error Value: datum. The dtml-var <datum> nevertheless is callable even ín the form itself. For completeness sake, the essential listing apart from the Next and Previous links for the method toondecr is: <dtml-in "decrQuery(_.None, _, datum=(_.str(datum)))" size=1 start=teller> <img src="<dtml-var imagenaam>.gif"> </dtml-in> Anybody any idea? Cheers, Dirk _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Andy McKay -
Dirk Van.Laanen