Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Form Elements - How To?

Reply
 
Old 04-10-2009   #1 (permalink)
Thomas


 
 

Form Elements - How To?

How do I process form elements from an HTML form that has been submitted to an asp file? I understand how to get the elements in the asp file from the submission, but I wand to be able to access them as follows:

Info first:

I have 10 radio buttons, 6 text boxes and 3 checkboxes.

I need to process the elements (hopefully) in a loop, but I can't seem to get this to work. I know it has something to do with the Document object, but I can't seem to find a definitive answer googling.

I can access the elements by using this method:
strRB1=request.form("radBTN1") etc...

Alas, I have to copy and paste this lots and if I decide to change the form (add/sub) elements, I obviously have to go back and edit this.

Al kinds of snippets, but I just can't figure it out.

I thank everyone in advance for any pointers, insight or help.

Thomas

My System SpecsSystem Spec
Old 04-11-2009   #2 (permalink)
Tim Williams


 
 

Re: Form Elements - How To?

There's no Document object in an ASP page (on the server) - that's a
client-side/browser object.

On the server you have the 'Request.Form', 'Request.Querystring' and
'Request.Cookies' collections (all of which are found in the 'Request'
collection).

You can loop through the collection

For Each f in Request.Form
response.write f & " = " & Request(f) & "<br>"
Next

but that's not going to help you much since you need to do specific things
with each of the values.

You could use some kind of naming convention:

for x=1 to 10
response.write Request("rad" & x) & "<br>"
next

There are probably a number of different approaches you could take.
In the end it all depends on what you're going to do with the submitted
values.


Tim



"Thomas" <thomas.regall@xxxxxx> wrote in message
news:uwoBjdeuJHA.4648@xxxxxx
How do I process form elements from an HTML form that has been submitted to
an asp file? I understand how to get the elements in the asp file from the
submission, but I wand to be able to access them as follows:

Info first:

I have 10 radio buttons, 6 text boxes and 3 checkboxes.

I need to process the elements (hopefully) in a loop, but I can't seem to
get this to work. I know it has something to do with the Document object,
but I can't seem to find a definitive answer googling.

I can access the elements by using this method:
strRB1=request.form("radBTN1") etc...

Alas, I have to copy and paste this lots and if I decide to change the form
(add/sub) elements, I obviously have to go back and edit this.

Al kinds of snippets, but I just can't figure it out.

I thank everyone in advance for any pointers, insight or help.

Thomas


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Adobe Photoshop Elements 6 & Adobe Premiere Elements 4 Vista music pictures video
Can't delete elements in folder Recent elements Vista General
Elements 6 No Cd Rom Drivers
Support for Adobe photoshop elements 5 or premier elements 3 on Vista 64 bits Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46