|
 |
javascript thread: how can I pass post variables with javascript? / how to pass the value of the submit button when pressing enter in a text field?
Message #1 by "Flummi" <flummi@e...> on Fri, 17 May 2002 09:02:54
|
|
"I wanted to use the same name for both buttons, since I extract
all the form variables later in the code and save them in session
variables"
Why would giving your buttons the same name be relevant to this? Why do your
buttons need names at all?
In any case, if you have more than one element with the same name, then this
forms a collection which you need to iterate through. A group of checkboxes
is the most common scenarion in which this would be necessary.
mygroup = request.form("mygroup")
then to extract individual values
for n=0 to mygroup.length-1
session("mygroup_" & n) = mygroup(n)
next
(Might be .count rather than .length, I can never remember... but this
property only exists when there is more than one, so if only one checkbox is
checked you get an error when trying to iterate through. I always add in a
dummy checked checkbox which is not visible, to prevent the error if one is
checked)
-----Original Message-----
From: Flummi [mailto:flummi@e...]
Sent: 17 May 2002 12:25
To: javascript
Subject: [javascript] Re: how can I pass post variables with javascrip
t? / how to pass the value of the submit button when pressing enter in a
text field?
Yes, but I wanted to use the same name for both buttons, since I extract
all the form variables later in the code and save them in session
variables. But I guess I will have to filter these fields out from saving
them to session variables (as I do with the action field).
It would have been nice, if there is another way to do it, i.e. with some
javascript.
> Its because you've given your submit button the same name as the hidden
field. The submit button does not need a name, but if you want to give it
one make sure its unique
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.
|
|
 |