473,394 Members | 1,965 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,394 software developers and data experts.

Request.Form & Arrays

I'm trying to use Request.Form to gather information in an array and I keep
getting a type mismatch...not sure if it's even possible. Basically, Page 1
posts to Page 2...and Page 1 contains a variable declared as:

Dim mLic(50)

....which is then populated. When I try:

Request.Form("mLic()") or
Request.Form("mLic") or
Request.Form("mLic(50)")

I get a type mismatch every time. Is there a better/right way to do this?

Thanks!
James
Jul 19 '05 #1
8 2517
How are you sending an "array" via post? Get and Post handle strings
only... you't can pass an array like this and retrieve it via the request
collection.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"James Baker" <cp******@hotmail.com> wrote in message
news:ez*************@TK2MSFTNGP11.phx.gbl...
I'm trying to use Request.Form to gather information in an array and I keep getting a type mismatch...not sure if it's even possible. Basically, Page 1 posts to Page 2...and Page 1 contains a variable declared as:

Dim mLic(50)

...which is then populated. When I try:

Request.Form("mLic()") or
Request.Form("mLic") or
Request.Form("mLic(50)")

I get a type mismatch every time. Is there a better/right way to do this?

Thanks!
James

Jul 19 '05 #2
Fair enough...(forgive me, I'm trying to learn ASP again). Can a Session
variable handle this? What's the ideal method for "sharing" an array
between pages?

James
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:eS**************@TK2MSFTNGP09.phx.gbl...
How are you sending an "array" via post? Get and Post handle strings
only... you't can pass an array like this and retrieve it via the request
collection.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"James Baker" <cp******@hotmail.com> wrote in message
news:ez*************@TK2MSFTNGP11.phx.gbl...
I'm trying to use Request.Form to gather information in an array and I keep
getting a type mismatch...not sure if it's even possible. Basically, Page 1
posts to Page 2...and Page 1 contains a variable declared as:

Dim mLic(50)

...which is then populated. When I try:

Request.Form("mLic()") or
Request.Form("mLic") or
Request.Form("mLic(50)")

I get a type mismatch every time. Is there a better/right way to do

this?
Thanks!
James


Jul 19 '05 #3
Page 1:

dim myArray(1)
myArray(0) = "a"
myArray(1) = "b"
session("myArray") = myArray

Page 2:

myArray = session("myArray")
response.write myArray(0)

However, unless this is a complex array, you are likely better off to avoid
session variable and pass a comma-delimited string around. IMHO.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"James Baker" <cp******@hotmail.com> wrote in message
news:uS**************@TK2MSFTNGP11.phx.gbl...
Fair enough...(forgive me, I'm trying to learn ASP again). Can a Session
variable handle this? What's the ideal method for "sharing" an array
between pages?

James
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:eS**************@TK2MSFTNGP09.phx.gbl...
How are you sending an "array" via post? Get and Post handle strings
only... you't can pass an array like this and retrieve it via the request
collection.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"James Baker" <cp******@hotmail.com> wrote in message
news:ez*************@TK2MSFTNGP11.phx.gbl...
I'm trying to use Request.Form to gather information in an array and I

keep
getting a type mismatch...not sure if it's even possible. Basically,

Page
1
posts to Page 2...and Page 1 contains a variable declared as:

Dim mLic(50)

...which is then populated. When I try:

Request.Form("mLic()") or
Request.Form("mLic") or
Request.Form("mLic(50)")

I get a type mismatch every time. Is there a better/right way to do

this?
Thanks!
James



Jul 19 '05 #4
James Baker wrote:
I'm trying to use Request.Form to gather information in an array and
I keep getting a type mismatch...not sure if it's even possible.
Basically, Page 1 posts to Page 2...and Page 1 contains a variable
declared as:

Dim mLic(50)

...which is then populated.


Does this occur in client-side or server-side code?

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #5
Server side...I realized the error of my ways when trying to "POST" the
array. Now I'm searching for a better approach.
Jul 19 '05 #6
Well, I'm toying with the idea of just written out hidden tags/values and
using request.form that way, as opposed to the array. In order to pass a
comma delimited string, I'd have to parse/concatenate the entire array,
right? I'm trying to see the benefit I guess.
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:uN**************@TK2MSFTNGP09.phx.gbl...
Page 1:

dim myArray(1)
myArray(0) = "a"
myArray(1) = "b"
session("myArray") = myArray

Page 2:

myArray = session("myArray")
response.write myArray(0)

However, unless this is a complex array, you are likely better off to avoid session variable and pass a comma-delimited string around. IMHO.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"James Baker" <cp******@hotmail.com> wrote in message
news:uS**************@TK2MSFTNGP11.phx.gbl...
Fair enough...(forgive me, I'm trying to learn ASP again). Can a Session
variable handle this? What's the ideal method for "sharing" an array
between pages?

James
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:eS**************@TK2MSFTNGP09.phx.gbl...
How are you sending an "array" via post? Get and Post handle strings
only... you't can pass an array like this and retrieve it via the request collection.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"James Baker" <cp******@hotmail.com> wrote in message
news:ez*************@TK2MSFTNGP11.phx.gbl...
> I'm trying to use Request.Form to gather information in an array and I keep
> getting a type mismatch...not sure if it's even possible.

Basically, Page
1
> posts to Page 2...and Page 1 contains a variable declared as:
>
> Dim mLic(50)
>
> ...which is then populated. When I try:
>
> Request.Form("mLic()") or
> Request.Form("mLic") or
> Request.Form("mLic(50)")
>
> I get a type mismatch every time. Is there a better/right way to do

this?
>
> Thanks!
> James
>
>



Jul 19 '05 #7
James Baker wrote:
Well, I'm toying with the idea of just written out hidden tags/values
and using request.form that way, as opposed to the array. In order
to pass a comma delimited string, I'd have to parse/concatenate the
entire array, right? I'm trying to see the benefit I guess.


No. You can use the Join function to return a delimited string from an
array. You can then response.write the string into a hidden form element.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #8
Thanks for your help...I think I'm good to go now. With every passing
moment, I appreciate ASP.NET that much more.
Jul 19 '05 #9

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

Similar topics

5
by: Paxton | last post by:
I created an html email containing a form whose method is POST. The form is posted to an asp page for processing, but no values are retrieved. So I response.write all the Request.Form fields, and...
2
by: Mark Hannon | last post by:
I am trying to wrap my brain around storing form elements inside variables & arrays before I move on to a more complicated project. I created this simple example to experiment and as far as I can...
3
by: Martin Speight | last post by:
Hello, In an ASP script Request.Form() returns a value fine. But I want to be able to chop the returned value up using substring. Having trouble getting the return into a String variable so...
5
by: jab3 | last post by:
(again :)) Hello everyone. I'll ask this even at risk of being accused of not researching adequately. My question (before longer reasoning) is: How does declaring (or defining, whatever) a...
1
by: ss | last post by:
Hi, I would like to know like in ASP.NET 2.0 or .net version 2.0, how do I parse the XML and consume it?. right now I am using the old methods like XML DOM. second thing is I need to send...
7
by: eric.goforth | last post by:
Hello, I'm working with a classic asp page that calls another classic asp page. The html in my calling page looks like: <form method="post"...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
2
by: Ixnay | last post by:
Thanks in advance for any help you can give me on this. I am trying to include the value from a request.querystring in the DataNavigateUrlFormatString I am able to include one of the values...
4
by: Olivier Matrot | last post by:
Hello, I have a problem with an ASP.NET 2.0 Application. A client request is processed in parrallel by two threads. This ends with the following exception : <Source>System</Source> <StackTrace...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.