473,320 Members | 2,088 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,320 software developers and data experts.

CGI module: get form name

ej

I'm not seeing how to get at the 'name' attribute of an HTML <form> element.

form = cgi.FieldStorage()

gives you a dictionary-like object that has keys for the various named
elements *within* the form...

I could easily replicate the form name in a hidden field, but there ought to
be some way to get directly at the form name but I'm just not seeing it. I
looked in the os.environ() - don't see it there.

Any ideas?

Thanks! :)

--------------------------------------------------------------
"I strongly believe what we're doing is the right thing. If I didn't believe
it-I'm going to repeat what I said before-I'd pull the troops out, nor if I
believed we could win, I would pull the troops out." --President George W.
Bush, Charlotte, N.C., April 6, 2006
Apr 13 '06 #1
2 1763
ej wrote:
I'm not seeing how to get at the 'name' attribute of an HTML <form> element.

form = cgi.FieldStorage()

gives you a dictionary-like object that has keys for the various named
elements *within* the form...

I could easily replicate the form name in a hidden field, but there ought to
be some way to get directly at the form name but I'm just not seeing it.


There isn't. This is a limitation of the CGI protocol, due to the way
HTTP requests work. I.e., the name attribute of <form> is *not*
included in form submissions. Regardless of whether the method is GET
or POST, it's only the fields' key/value pairs that are encoded and
sent off to the server.

If you need it, a hidden field is a good place for the form name. Or
you could use cookies.

Hope that helps,
--Ben

Apr 13 '06 #2
"ej" <ejohnso9 at @earthlink.dot.net> wrote:

I'm not seeing how to get at the 'name' attribute of an HTML <form> element.

form = cgi.FieldStorage()

gives you a dictionary-like object that has keys for the various named
elements *within* the form...

I could easily replicate the form name in a hidden field, but there ought to
be some way to get directly at the form name but I'm just not seeing it. I
looked in the os.environ() - don't see it there.


Nope, the form name is not transmitted as part of the HTTP request. It
only exists for the convenience of the client-side code (like Javascript).
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Apr 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lumpierbritches | last post by:
I have code I'm using repeatedly in my program, and would like to convert it to a module or macro, can anyone assist me? Thank you in adavance for all assistance, it is greatly appreciated. Dim...
4
by: http://www.visual-basic-data-mining.net/forum | last post by:
Hi Does anyone know how to stay connected to the server and at the same time i can pass the string to and from the module to the form..... What I want: I put the connection at the...
4
by: excelleinc.com | last post by:
Hello, I'm trying to put sub that's shared between all forms in my app in module so when I make change I just change it one time. This sub should execute and then invoke sub defaults() that's...
9
by: Rudy | last post by:
Hello All! I'm a little confused on Public Class or Modules. Say I have a this on form "A" Public Sub Subtract() Dim Invoice As Decimal Dim Wage As Decimal Static PO As Decimal Invoice =...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.