Is question the same page that displays the link? If not you do not
need the redirection because you can make the decrement via ajax.
Otherwide:
form[0][-1][1].append(INPUT(_type='button',_value=T('Previous')
,_onclick='document.location="%s"'
%URL("question2")))
def question2():
session.current_item -=1
redirect(URL('question'))
how this helps.
On May 3, 7:14 am, niknok <[email protected]> wrote:
> The old function I used passed values using args. Now I'm using
> session variables instead, so I need a way to move forward and
> backward between records.
>
> I need the button to decrement the session variable, then redirect to
> the page.
>
> On May 2, 9:36 pm, Massimo Di Pierro <[email protected]>
> wrote:
>
>
>
>
>
>
>
> >http://mywiki.wooledge.org/XyProblem
>
> > what do you want to do exactly?
>
> > On May 1, 8:04 pm, niknok <[email protected]> wrote:
>
> > > I have this button that redirects to a URL:
>
> > > form[0][-1][1].append(INPUT(_type='button',_value=T('Previous')
> > > ,_onclick='document.location="%s"'
> > > %URL("question")))
>
> > > what do I add to _onclick to do the following:
> > > 1) session.current_item -=1
> > > 2) redirect(URL('question'))
>
> > > /r
> > > Nik