[Zope] redirection from within forms with submit button

Dirk Van.Laanen Dirk.Van.Laanen@niwi.knaw.nl
Wed, 27 Mar 2002 09:25:21 +0100


Hello,=20

The idea is to call a method to display an image from a certain date=20
(eg 1796/03/11) en get the n-th (eg 5-th) image for that particular =
day.=20
>From there i want to be able to page to Next and Previous, which is in=20
effect a traversal in batches of one. This works if in the method =
<toondecr>=20
I use links like these:

<td align=3Dright valign=3D"top" width=3D"100%">
<dtml-if next-sequence>
<dtml-in expr=3D"decrQuery(datum=3D(_.str(datum)))" next size=3D1 =
orphan=3D1 start=3Dteller>
         <a href=3D"<dtml-var URL><dtml-var sequence-query
            >teller=3D<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.=20
The following works from a separate method (which only consists of the =
following):=20

<form method=3D"post" action=3D"">
<input type=3D"submit" name=3D"x" value=3D"&gt;&nbsp;">
<dtml-if x>
<dtml-call "REQUEST.set('datum', _.str('1796/03/11'))">
<dtml-call "REQUEST.set('teller', 5)">
<input type=3D"hidden" name=3D"" value=3D"<dtml-call "RESPONSE.redirect('to=
ondecr2?datum=3D%s&teller=3D%s' %=20
(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 =EDn the form itself.=20

For completeness sake, the essential listing apart from the Next and =
Previous links for the method toondecr is:=20

<dtml-in "decrQuery(_.None, _, datum=3D(_.str(datum)))" size=3D1 start=3Dte=
ller>
<img src=3D"<dtml-var imagenaam>.gif">
</dtml-in>



Anybody any idea?=20

Cheers, Dirk=20