Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Request.Form has no value after setting a hidden field

Status
Not open for further replies.

briancostea

Programmer
Apr 21, 2005
82
US
The alert boxes produce the correct output, but the Response.Write Request.Form("exp") statement produces no output. Any ideas would be greatly appreciated. Thanks in advance.

%>
<form name=shw>
<INPUT TYPE=HIDDEN NAME=exp id=exp>
</form>
<script language="JavaScript">
alert(parent.left.document.frmDisp.lstExperts.value);
document.shw.exp.value =
parent.left.document.frmDisp.lstExperts.value;
alert(document.shw.exp.value);
</script>
<%
Response.Write (Request.Form("exp"))
 
there is no submit button. For request.form to work you need to submit the form
 
Form should still submit on Enter key...

Maybe that happens because default <FORM> method is GET... and Request.Form expects POST.

------
heisenbug: A bug that disappears or alters its behavior when one attempts to probe or isolate it
schroedinbug: A bug that doesn't appear until someone reads source code and realizes it never should have worked, at which point the program promptly stops working for everybody until fixed.

[ba
 
but he didn't hit enter, as for the form method

use Response.Write Request("exp")
 
he's requesting the information at the bottom of the same page. so this simply won't work. unless the page prior to this had a field on it called "exp" and was passed through the "post" method of the form.
 
well...you can't use request.form to request data on the same page. or not that i've heard of anyway. i've always heard of the request being used on the called page from the action property of the form tag on the previous page. so yeah...it's quite relevant.
 
In any case - scrap Enter key [hammer]. This form has no visual elements at all.

It probably never gets submitted, and if it does there is GET vs POST issue we all mentioned.

------
heisenbug: A bug that disappears or alters its behavior when one attempts to probe or isolate it
schroedinbug: A bug that doesn't appear until someone reads source code and realizes it never should have worked, at which point the program promptly stops working for everybody until fixed.

[ba
 
Is this value supposed to pick up when the page is submitted to itself or is there some confusion here between client and server side code?
 
the latter. the client-side code is picking up the value because it's set. however, the response.write is trying to print the value of data on the same page without anything being submitted.
 
a page that submits to itself is an example of requesting data on same page

Also sheco, i agree he is confused with client-side vs sever-side
 
i'll agree with the page submitting back to itself, but looking at that snippet...does anybody see anything that would even hint at it submitting anywhere??
 
lets just give hime the solution
Code:
<form name="shw" method="post">
 <INPUT TYPE="HIDDEN" NAME="exp" id="exp" value="hello world">
<input type="submit" value="submit">
</form>
<%
Response.Write Request("exp")
%>
 
I only did that cause we are up to 15 post and still no response from the poster
 
Sorry about the late response. I guess my real question is ... I have a page with two frames, one of which has a form. I am trying to display the info in the second frame. How do I get the value of a form element from another frame? I was trying to use javascript to store the value in a hidden field, and you answered my question of why that didn't work. Does any one know how to do this or store the value of a javascript variable into an asp variable? Thanks - Brian.

ps - here is the link to my page:


click the lower "go" button.
 
pass the value to a querystring in the url
ex.
("port.asp?youquery=something")

then use
strvar = request("youquery")
 
I'm not sure if i can do that. The left frame doesn't submit port.asp, but rather changes the right frame.
 
what you can do is that the onchange event is a jump menu that just appends a querystring
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top