473,326 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to handle multiple submits using mod_python ?

6
Hi,

if I have two submit buttons on my html page, how do I know which one is pressed when using python ?

Example:
<form action="test.py">
<input type=submit name=add value=Add>
<input type=submit name=del value=Del>
</form>
----
def myfunction(req, var1, var2):
???

I can't find anything about this in mod_python documentation, does anyone know ?

Thanks!
/P
Dec 11 '06 #1
4 3036
sashi
1,754 Expert 1GB
Hi,

if I have two submit buttons on my html page, how do I know which one is pressed when using python ?

Example:
<form action="test.py">
<input type=submit name=add value=Add>
<input type=submit name=del value=Del>
</form>
----
def myfunction(req, var1, var2):
???

I can't find anything about this in mod_python documentation, does anyone know ?

Thanks!
/P
Hi there,

Am not sure about this too, i suggest to use javascript to handle this issue. Good luck & Take care.
Dec 12 '06 #2
poppor
6
Hi there,

Am not sure about this too, i suggest to use javascript to handle this issue. Good luck & Take care.
But there must be a way to do this in Python. Maybe a separate form for each button ? I'm going to google some more :)

Thanks!
/P
Dec 12 '06 #3
poppor
6
Oh.. it was so simple. Here's the solution.
If you have several submit buttons, all you have to do is go by there value.
Example:

mysite.html
-------------------
<form action=myscript.py method="POST">
Button1:<input type=submit name=submitter value=1>
Button2:<input type=submit name=submitter value=2>
</form>

myscript.py
------------------
def index(req, submitter):
if submitter = 1:
s = "Button 1 is pressed"
else:
s = "Button 2 is pressed"
return s


Regards
/P
Dec 12 '06 #4
sashi
1,754 Expert 1GB
Hi there,

Am not sure about this too, i suggest to use javascript to handle this issue. Good luck & Take care.
Hi there,

Why not try asking in Python forum section? Good luck & Take care.
Dec 13 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Peter Clark | last post by:
Think of something like MyYahoo: a personalized portal with news aggregator, weather forecast, comics, etc. Now instead of visiting a web site, think of all of it being sent daily as an email. It...
3
by: Rune Hansen | last post by:
I've posted this question on the mod_python mailing list but didn't get much response, so I thought I'd post it here. (My first attempt connected to an unrelated thread..sorry....
0
by: Python_it | last post by:
I'm going to work with mod_python. I install mod_python 3.2.2b for python 2.4. If i test my install with mptest.py see this link:...
1
by: neha | last post by:
hi, i m trying to integrate python with apache on linux.For this i m using mod_python. I dont see any problem with the versions of python,apache and mod_python i m using. the versions i m using...
0
by: Tiro | last post by:
Hi, I am trying to understand how does .Net Web Service handle requests for multiple clients simultaneously. Here is what I am trying to achieve. I have created a web serive that search...
6
by: RobR | last post by:
We have a customer using our application that has a problem. Within our app, we have a two different forms (one generates an email, the other a fax via a webservice). When they click the submit...
3
by: yinglcs | last post by:
Hi, I am trying to setup Apache with Trac which uses mod_python. I get the following error: assert have_pysqlite 0 And I have verify this via command line as well, that seem no problem....
2
by: Eduardo Dobay | last post by:
Hello, I've been playing around with mod_python these days (using Publisher and PSP), and it has been working smoothly under Windows XP (using Apache 2.2). But when I installed PSE and went to use...
3
by: joe jacob | last post by:
I configured apache to execute python scripts using mod_python handler. I followed below mentioned steps to configure apache. 1. In http.conf I added <Directory...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.