button to submit with several parameters and call python script
Hi Dears, I am looking for ideas of how to use a submitting button to pass several parameters to a python script. I have googled but I found different solutions not really appropriate to my case I guess. I was trying something like this: <form action="do_status.py" method="POST"> <input type="hidden" name="jname:string"> <input type="hidden" name="juser:string"> <input type="submit" value="Submit"> </form> Then I defined my do_status.py with parameters jname, juser
print jname, juser return printed
and nothing is printed. But what I would like was something like clicking on a button I would call a specific python script with parameters, eg: <span tal:content="python: here.do_status(jname,juser)"> Any help here would be very appreciated. Many thanks in advance. Cheers, Alan -- Alan Wilter S. da Silva, D.Sc. - Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK.
----- Original Message ----- From: "Alan" <alanwilter@gmail.com> To: <zope@zope.org> Sent: Tuesday, August 01, 2006 7:53 PM Subject: [Zope] button to submit with several parameters and call pythonscript
I was trying something like this:
<form action="do_status.py" method="POST"> <input type="hidden" name="jname:string"> <input type="hidden" name="juser:string"> <input type="submit" value="Submit"> </form>
Then I defined my do_status.py with parameters jname, juser
print jname, juser return printed
and nothing is printed.
This is an html question, not a zope question, but... you are missing the "value" attribute:
<input type="hidden" name="jname:string" value="do something to get a value here"> <input type="hidden" name="juser:string" value="xxx">
Jonathan
Alan wrote:
Hi Dears,
I am looking for ideas of how to use a submitting button to pass several parameters to a python script.
I have googled but I found different solutions not really appropriate to my case I guess.
I was trying something like this:
<form action="do_status.py" method="POST"> <input type="hidden" name="jname:string"> <input type="hidden" name="juser:string"> <input type="submit" value="Submit"> </form>
Then I defined my do_status.py with parameters jname, juser
print jname, juser return printed
Try print context.REQUEST.get('jname','???')
and nothing is printed.
David
Thanks guys, but I got another solution that worked (after some hours googling). <input type="hidden" name="juser" tal:attributes="value juser"> Cheers, Alan On 02/08/06, David H <bluepaul@earthlink.net> wrote:
Alan wrote:
Hi Dears,
I am looking for ideas of how to use a submitting button to pass several parameters to a python script.
I have googled but I found different solutions not really appropriate to my case I guess.
I was trying something like this:
<form action="do_status.py" method="POST"> <input type="hidden" name="jname:string"> <input type="hidden" name="juser:string"> <input type="submit" value="Submit"> </form>
Then I defined my do_status.py with parameters jname, juser
print jname, juser return printed
Try print context.REQUEST.get('jname','???')
and nothing is printed.
David
-- Alan Wilter S. da Silva, D.Sc. - Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK.
participants (3)
-
Alan -
David H -
Jonathan