473,326 Members | 2,196 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.

get all the form fields in a form

I'll never understand this

for each ?? in request.form.items
response.write ??

next

what the heck is ?? and how do yo dim it?
can it be any name?
Jan 26 '07 #1
20 19169
Hi Mr.,

foreach (string key in Request.Form.AllKeys)
{
Response.Write(key);
Response.Write("=");
Response.Write(Request.Form[key]);
Response.Write("<br>");
}
--
Milosz
"Mr. SweatyFinger" wrote:
I'll never understand this

for each ?? in request.form.items
response.write ??

next

what the heck is ?? and how do yo dim it?
can it be any name?
Jan 26 '07 #2
I'll never understand this
>
for each ?? in request.form.items
response.write ??

next

what the heck is ?? and how do yo dim it?
can it be any name?
Dim entryName as String

for each entryName in Request.Form
Response.Write("Name: " & entryName & "<br/>")
Response.Write("Value: " & Request.Form[entryName] & "<br/>")
next
HTH
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujinionline.com
-----------------------------------------
Jan 26 '07 #3
For Each makes a loop through items in collection of Request.Form,
and item is a string, specifying the name of the form field that's being
sent

Dim Item as String

For Each Item in Request.Form
Response.Write Item
Response.Write Request.Form(Item)
Next


"Mr. SweatyFinger" <sw@sw1finger.comwrote in message
news:eP**************@TK2MSFTNGP03.phx.gbl...
I'll never understand this

for each ?? in request.form.items
response.write ??

next

what the heck is ?? and how do yo dim it?
can it be any name?

Jan 26 '07 #4
For Each Item in Request.Form
Response.Write Item
Response.Write Request.Form(Item)
Next

I know off topic, anyone here know of a C# equivelent?

Gary.
Jan 26 '07 #5
"Gary" <g@nospam.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
>For Each Item in Request.Form
Response.Write Item
Response.Write Request.Form(Item)
Next

I know off topic,

Why off-topic...? This is an ASP.NET newsgroup after all... :-)
anyone here know of a C# equivelent?
foreach (string strKey in Request.Form)
{
Response.Write(strKey);
Response.Write "=";
Response.Write(Request.Form[strKey].ToString());
Response.Write("<br />");
}
Jan 26 '07 #6
I know off topic,
>
Why off-topic...? This is an ASP.NET newsgroup after all... :-)

Oh yeah :)

>anyone here know of a C# equivelent?

foreach (string strKey in Request.Form)
{
Response.Write(strKey);
Response.Write "=";
Response.Write(Request.Form[strKey].ToString());
Response.Write("<br />");
}

Cheers dude.

G.
Jan 26 '07 #7
why does the thing need to be named "item"? or does it??


Jan 26 '07 #8
why does the thing need to be named "item"? or does it??

Doesn't have to be named item.
It's just a variable name dear!
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujinionline.com
-----------------------------------------
Jan 26 '07 #9
Dim AnyName as String
"Mr. SweatyFinger" <sw@sw1finger.comwrote in message
news:ux**************@TK2MSFTNGP04.phx.gbl...
why does the thing need to be named "item"? or does it??


Jan 26 '07 #10

That's what I don't get.
if item can be named anything...

how does the procedure know that I want items, as opposed to any of the
other properties?
Jan 26 '07 #11
The collection of Request.Form has only item names and you can't get other
properties.

It is the same with any other collection, for example, when you have an
array of strings

Dim lines As String()
Dim line As String
For Each line In lines
Next

This code enumerates the strings in array.

"Mr. SweatyFinger" <sw@sw1finger.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>
That's what I don't get.
if item can be named anything...

how does the procedure know that I want items, as opposed to any of the
other properties?


Jan 27 '07 #12
well, given a collection, how are you supposed to know which is the default
property??


Jan 27 '07 #13
What do you mean by default property of collection?

According to MSDN:

Request.Form gets a collection of form variables. Its property value is
a NameValueCollection representing a collection of form variables. And
NameValueCollection Class represents a sorted collection of associated
String keys and String values that can be accessed either with the key
or with the index.

In other words, Request.Form is a collection of strings {"aa", "bb",
"cc"...}.

"aa" is a string which represent a name of a form variable

No properties.
On Jan 27, 1:59 am, "Mr. SweatyFinger" <s...@sw1finger.comwrote:
well, given a collection, how are you supposed to know which is the default
property??
Jan 27 '07 #14
Maybe the OP was referring to the default order of retrieval ?

When you do a call to the default Request collection,
each of the sub collections are searched in the following order:

1. QueryString
2. Form
3. Cookies
4. ClientCertificates
5. ServerVariables

The process stops when the first match is found.

Unfortunately, if there's same-name items in two or more sub collections,
you aren't guaranteed to receive the data you're looking for.

That's why you shouldn't use : Request("name")

You should use Request.Form("name") or Request.Cookies("name")
or Request.QueryString("name"), etc., always specifying the sub collection
you want to retrieve data from.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
What do you mean by default property of collection?

According to MSDN:

Request.Form gets a collection of form variables. Its property value is
a NameValueCollection representing a collection of form variables. And
NameValueCollection Class represents a sorted collection of associated
String keys and String values that can be accessed either with the key
or with the index.

In other words, Request.Form is a collection of strings {"aa", "bb",
"cc"...}.

"aa" is a string which represent a name of a form variable

No properties.
On Jan 27, 1:59 am, "Mr. SweatyFinger" <s...@sw1finger.comwrote:
>well, given a collection, how are you supposed to know which is the default
property??


Jan 27 '07 #15
Well, the question was about Request.Form as I see. Anyway, you're
right, it has to be more detailed
On Jan 27, 3:13 am, "Juan T. Llibre" <nomailrepl...@nowhere.com>
wrote:
Maybe the OP was referring to the default order of retrieval ?

When you do a call to the default Request collection,
each of the sub collections are searched in the following order:

1. QueryString
2. Form
3. Cookies
4. ClientCertificates
5. ServerVariables

The process stops when the first match is found.

Unfortunately, if there's same-name items in two or more sub collections,
you aren't guaranteed to receive the data you're looking for.

That's why you shouldn't use : Request("name")

You should use Request.Form("name") or Request.Cookies("name")
or Request.QueryString("name"), etc., always specifying the sub collection
you want to retrieve data from.

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
==================================="Alexey Smirnov" <alexey.smir...@gmail.comwrote in messagenews:11**********************@m58g2000cwm.g ooglegroups.com...
What do you mean by default property of collection?
According to MSDN:
Request.Form gets a collection of form variables. Its property value is
a NameValueCollection representing a collection of form variables. And
NameValueCollection Class represents a sorted collection of associated
String keys and String values that can be accessed either with the key
or with the index.
In other words, Request.Form is a collection of strings {"aa", "bb",
"cc"...}.
"aa" is a string which represent a name of a form variable
No properties.
On Jan 27, 1:59 am, "Mr. SweatyFinger" <s...@sw1finger.comwrote:
well, given a collection, how are you supposed to know which is the default
property??- Hide quoted text -- Show quoted text -
Jan 27 '07 #16
well, given a collection, how are you supposed to know which is the
default
property??
I have a small suggestion for you.
Go through the basics of .Net Framework, VB.Net and Collections-API before
starting with ASP.Net

And I'm damn serious. You may really mess up your ASP.Net learning
otherwise.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Jan 27 '07 #17
what I mean is there are several properties of a form field

when i loop through the "items", how am I supposed to know which of the
properties i am looping through

for instance, request.form has items, keys, allkeys, count.

why doesn't this pull in the keys, rather than the items.

For Each entryName In Request.Form

Response.Write("Name: " & entryName & "<br/>")

Response.Write("Value: " & Request.Form(entryName) & "<br/>")

Next
Jan 30 '07 #18
On Jan 27, 3:03 am, "Mr. SweatyFinger" <s...@sw1finger.comwrote:
what I mean is there are several properties of a form field

when i loop through the "items", how am I supposed to know which of the
properties i am looping through

for instance, request.form has items, keys, allkeys, count.

why doesn't this pull in the keys, rather than the items.

For Each entryName In Request.Form

Response.Write("Name: " & entryName & "<br/>")

Response.Write("Value: " & Request.Form(entryName) & "<br/>")

Next
For Each...Next loop is designed for collections and arrays only. It
means you could loop through elements of a collection or array only.

You can't loop through Count property because it's not a collection.

You can loop through Request.Form, Request.Form.Keys or
Request.Form.AllKeys collections.

For Each entryName In Request.Form.Keys
Response.Write("Name: " & entryName & "<br/>")
Response.Write("Value: " & Request.Form(entryName) & "<br/>")
Next

or

Dim loop1 As Integer
Dim arr1() As String
arr1 = Request.Form.AllKeys
For loop1 = 0 To arr1.GetUpperBound(0)
Response.Write("Form: " & arr1(loop1) & "<br>")
Next loop1

Jan 30 '07 #19
so how do you look at the screen and see what is a collection and what is
not?

what tells you? is there a certain color icon?
Jan 31 '07 #20
On Jan 31, 8:26 am, "Mr. SweatyFinger" <s...@sw1finger.comwrote:
so how do you look at the screen and see what is a collection and what is
not?

what tells you? is there a certain color icon?
I think nobody write a code starting from For Each. I supposed you
know that the code above gave you sort of iterated array of results.
You can see the type of property when you writing its name in Visual
Studio or placing the mouse cursor over code (intellisense). For
example, for line of code with Request.Form it shows me two lines
tooltip

System.Collection.Specialized.NameValueCollection HttpRequest.Form
Gets a collection of form variables.

If intellisense is not working or you use another IDE you can always
refer to help (e.g. www.msdn.com) where you will get much more
details about each property.

Jan 31 '07 #21

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

Similar topics

3
by: TG | last post by:
I have a form that POSTs to itself and validates data entered into the form. If all is well the form performs a header location command to move to the next input form in the series. If the user has...
4
by: bnp | last post by:
Hi All, I am quite new the JavaScript. Basically I am a C++ programmer, but now I am working on JavaScript since last 5 days. I have a problem regarding the form validation. I have created a...
4
by: karenmiddleol | last post by:
I have the following form the user enters the From and to period and presses the Submit button and the form fields are cleared once the submit button is pressed. Is there a way I can keep the...
3
by: Nelson R. | last post by:
Hi, im using a form to get some input from the user. This form is in a HTML file. When I post the form directly to my email, i receive all fields correctly. Example test.html: <FORM...
7
by: Chuck Anderson | last post by:
I'm pretty much a JavaScript novice. I'm good at learning by example and changing those examples to suit my needs. That said .... ..... I have some select fields in a form I created for a...
7
by: Perks | last post by:
Hi. I am trying to find out if it is possible to open a pdf file from within PHP, and parse its contents in order to extract all form fieldnames that might have been previously setup within the...
4
by: Mike De Petris | last post by:
I am using itextsharp to fill in and flatten some fields from data filled in a web form field and all works quite well. The question now is how to manage the pdf template that has the fields to...
3
by: wparrott | last post by:
Hello everyone, I'm trying add a print button that opens a Word document and fills in form fields in the document based on the currently displayed record. The code works in a sample that I ran but...
3
by: guido | last post by:
I've written a user control to add form fields to a aspx page: Private Sub buildFields() 'Label1.Text = "building fields at " & System.DateTime.Now() Dim themeIDField As New TextBox()...
1
by: Rick Owen | last post by:
Greetings, I have a form that, when submitted, calls a plsql procedure. The form has a number of fields (text, hidden, select, radio) but the particular field that is giving me problems is a...
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
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...
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: 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: 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: 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
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.