[mod_python] Newbie Question

Clodoaldo clodoaldo.pinto.neto at gmail.com
Thu Apr 10 15:29:04 EDT 2008


2008/4/10, mail-lists <mail-lists at peachnet.com>:
> Sean Allen wrote:
>
> >
> > On Apr 10, 2008, at 10:40 AM, mail-lists wrote:
> >
> > > Hello,
> > >
> > > I have a quick question and it might be very silly:
> > >
> > > How do I pass variables between pages short of building a query string
> into the URL? Is there a way to set variables in the request object?
> > >
> > > What I'm trying to do is the following:
> > >
> > > user fills out a form
> > > form calls saveform function
> > >
> >
> > when? via an onSubmit handler?
> >
>
>  no, no JavaScript at all, sorry. I guess I wasn't  very clear. Form
> action=saveform which is a python function ( def saveform(req) )
>
> >
> >
> > >
> > > input is validated
> > >
> >
> > where is the input validated? in 'saveform' that is a javascript function?
> >
>
>  input is validated in saveform.
>
> >
> >
> > >
> > > if not valid input return to the form with user values filled out.
> > >
> > >
> >
> > what exactly is 'return' here?
> > from a server side script? from a javascript validation routine?
> >
> >
>  return is a util.redirect back to the form.

Why redirect? Why don't you just put saveform in the same page of the
form and then return the form page now with the values of the inputs
filled.

>  My question is how do I pass request variables BACK to the form short of
> using a query string.
>
>  ie. is it possible to do something like the following:
>
>  req_data=util.FieldStorage(req)
> req_data["form_item"]="ThisisastringIwanttopopulatetheformwith"
>
>  I've tried this obviously but it doesn't work. I'm not sure if something
> like this SHOULD work because I don't quite understand whether or not the
> request object persists across the redirect.
>
>  I hope I'm asking this in the right way :)
>
>
>  Thank you
>
>
>
>
>
>
>
>
>
>
>
>  _______________________________________________
>  Mod_python mailing list
>  Mod_python at modpython.org
>  http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list