Home > Archive > ASP > June 2005 > Problem retrieving value via Request.Form
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Problem retrieving value via Request.Form
|
|
|
| Hi,
I have the following code in my form:
Response.Write("<form name='Testing'>");
Response.Write("<INPUT type=hidden id='Testing_txtbox'
name='Testing_txtbox' value='a simple test'>");
Response.Write("</form>");
If I type the following in the very next line, I get a value of
"undefined".
Response.Write("value="+Request.Form("Testing_txtbox"));
Can anyone tell me why this won't work. If it can't can anyone tell
me how I can retrieve values of hidden controls via Server side code?
Thanks
| |
| Ray Costanzo [MVP] 2005-06-03, 3:55 pm |
| That value won't exist in the Request.Form collection until it is posted by
the client back to the server. "<input type=hidden..." is merely a string
that is being sent back in the response. It has no ties to Request.Form.
That comes from when the visitor of your page submits a form. Then the form
collection will have something called Testing_txtbox.
Ray at work
"Chico" <ckl@ameritech.net> wrote in message
news:35p0a1hbqa4a3a037tdbl4fc28jok1m8lg@
4ax.com...
> Hi,
>
> I have the following code in my form:
>
> Response.Write("<form name='Testing'>");
> Response.Write("<INPUT type=hidden id='Testing_txtbox'
> name='Testing_txtbox' value='a simple test'>");
> Response.Write("</form>");
>
> If I type the following in the very next line, I get a value of
> "undefined".
>
> Response.Write("value="+Request.Form("Testing_txtbox"));
>
> Can anyone tell me why this won't work. If it can't can anyone tell
> me how I can retrieve values of hidden controls via Server side code?
>
> Thanks
>
| |
| Patrice 2005-06-03, 3:55 pm |
| Add method="post" to your form tag. By default it uses the GET method (ie
uses the querystring) and the form collection is empty...
(you'll likely have also to change the logic as this value is available only
once the user entered something and submitted the form, not during the
initial display).
Patrice
--
"Chico" <ckl@ameritech.net> a écrit dans le message de
news:35p0a1hbqa4a3a037tdbl4fc28jok1m8lg@
4ax.com...
> Hi,
>
> I have the following code in my form:
>
> Response.Write("<form name='Testing'>");
> Response.Write("<INPUT type=hidden id='Testing_txtbox'
> name='Testing_txtbox' value='a simple test'>");
> Response.Write("</form>");
>
> If I type the following in the very next line, I get a value of
> "undefined".
>
> Response.Write("value="+Request.Form("Testing_txtbox"));
>
> Can anyone tell me why this won't work. If it can't can anyone tell
> me how I can retrieve values of hidden controls via Server side code?
>
> Thanks
>
|
|
|
|
|