Request.QueryString() and/or Request.Form()

G

George

VS.NET 2002/VB

Is it possible to retrieve HTML form variables that are hidden input types using
Request.QueryString() and/or Request.Form()?

I have tried various ways of using those, but to no avail. My HTML form method is set to POST, and I
thought I had read somewhere that this could be done.

If it is not possible, is there any way to retrieve HTML form variables into my .aspx page?

Thanks,
George
 
M

Marina

Request.QueryString is only for parameters passed in the URL.

Request.Form works very nicely for retrieving posted hidden controls.
 
G

George

Marina,

Actually, I didn't really explain my problem very well.

I have an .htm page that uses an HTML form button to open my .aspx page in a new window without any
buttons on it. That may be why I can't retrieve my hidden inputs in the HTML form, because, even
though the method is set to POST, the action is set to call a javascript function that uses
window.open() to open my .aspx page in the new window, instead of the action being set to call the
..aspx page directly.

I am not certain, but is it possible to retrieve those hidden inputs like that? If not, is there
anyway of doing it?

Thanks,
George
 
K

Kevin Spencer

You can certainly retrieve posted form values from the Request.Form
Collection. It should be noted that this Collection is keyed by the "name"
attribute of the form fields, not the id.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
K

Kevin Spencer

Hi George,

If I understand you correctly, you are using the JavaScript window.open()
mthod to open a child window, and you want to retrieve some form values from
the parent window in the child window? If that's the case, you should be
aware that the only way for those 2 pages to "talk" is on the client, via
JavaScript. On the server, the classes don't even exist at the same time.
Only on the client are they concurrent and able to communicate. In the child
window, you refer to the parent window as "opener." So, if you want to get
the value of a form field in the parent with the name "foo" you could use
something like the following:

<script type="text/javascript"><!--
var s = opener.document.forms[0].foo.value;
// --></script>

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
G

George

Kevin,

Thanks for the suggestions and the lesson; it's always appreciated.

George

Kevin Spencer said:
Hi George,

If I understand you correctly, you are using the JavaScript window.open()
mthod to open a child window, and you want to retrieve some form values from
the parent window in the child window? If that's the case, you should be
aware that the only way for those 2 pages to "talk" is on the client, via
JavaScript. On the server, the classes don't even exist at the same time.
Only on the client are they concurrent and able to communicate. In the child
window, you refer to the parent window as "opener." So, if you want to get
the value of a form field in the parent with the name "foo" you could use
something like the following:

<script type="text/javascript"><!--
var s = opener.document.forms[0].foo.value;
// --></script>

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

George said:
Marina,

Actually, I didn't really explain my problem very well.

I have an .htm page that uses an HTML form button to open my .aspx page in a new window without any
buttons on it. That may be why I can't retrieve my hidden inputs in the HTML form, because, even
though the method is set to POST, the action is set to call a javascript function that uses
window.open() to open my .aspx page in the new window, instead of the action being set to call the
.aspx page directly.

I am not certain, but is it possible to retrieve those hidden inputs like that? If not, is there
anyway of doing it?

Thanks,
George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top