python cgi questions

DeepBlue DeepBlue at DeepBlue.org
Mon Dec 10 09:23:34 EST 2001


"Kevin Cazabon" <kevin at cazabon.com> wrote in message
news:5a4226f0.0112092040.5cf0cab1 at posting.google.com...
> I'd suggest going at it the other way around:
>
> Use a normal submit button for the form, and include an onclick to
> update the href location of the frame to the downloaded file.  Kind of
> like:
>
> <form method=POST action="myform.cgi" name="form1">
> <input type=hidden name=whatever value=crap>
> <input type=submit name=submit value=submit
> onclick="_self.location.href='/downloads/file.exe'">
> </form>
>
I tried that and it would not work.  It just ran myform.cgi
I changed the type from submit to button.  Then it would download the file
but the form is not submitted.
DeepBlue


> I believe that will do what you want... try it out though first, of
> course, it's written off the top of my head.
>
> No cgi is really needed here, except myform.cgi for taking the info
> from the form and updating the database.  You could even use a
> variable value in the onclick so that it downloaded a file specified
> by some other item on the form.
> (onclick="_self.location.href=self.form1.selectfieldname.value"
>
> Kevin Cazabon.
>
>
>
> "DeepBlue" <DeepBlue at DeepBlue.org> wrote in message
news:<8SRQ7.22622$zp5.1091695 at typhoon.austin.rr.com>...
> > I have the following cgi python question.
> > I need to allow users to download  files through a series of HREF links.
> > But also I need to be able to update a database table when a user clicks
on
> > the link.
> > So, each file to be downloaded is in its separate Form.  And each link
has
> > an ONCLICK event that submits the form for the corresponding file.  When
the
> > form is submitted I was hoping that the database is updated with values
in
> > hidden fields in each form, and the user can download the file.
> > But, I can accomplish only one thing:  either the form is submitted or
the
> > file is downloaded.
> > Can both things be accomplished:
> > 1.  File is downloaded when link is clicked, and
> > 2.  Form is submitted through onclick event in javascript
> > (onclick=document.form.submit)
> >
> >
> > Also, is it possible using a python script to submit a form in the
> > background without anything being returned to the browser?
> > In this case, I send the information via the python script (form
submitted)
> > and the database is updated, but nothing is returned to the browser so
that
> > the current page stays as is.
> > Thanks for any help or hints,
> > DB





More information about the Python-list mailing list