Request.form isn't working

S

Scott Durrett

I have 2 pages. Page1 is a .html page with a form, hidden input, and a
submit button. I have the action set to Post.

<form id="form1" action="paymentcatch.aspx" method="post">

<input id="wtf" type="text" value="thisisnotworking" />


<input id="Submit1" type="submit" value="submit" />

</form>



Page 2 is ASPX (c#). On the page load I want to read the value from the
hidden input on Page1.

I'm trying to read the hidden input like this: Reques.Form["wtf"]

Everytime the result is null. Has anyone else had this issue?

Thanks In Advance
Scott
 
K

Karl Seguin [MVP]

forms are submitted based on the NAME field, not the IDfield..

try
<input id="wtf" name="wtf" type="text".../>

Karl
 
S

Scott Durrett

Karl,

Thank for the suggestion. Looks like the Request object is coming in blank
on my aspx catch page. I cannot figure this darn thing out. :)

Scott



"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:[email protected]...
forms are submitted based on the NAME field, not the IDfield..

try
<input id="wtf" name="wtf" type="text".../>

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


Scott Durrett said:
I have 2 pages. Page1 is a .html page with a form, hidden input, and a
submit button. I have the action set to Post.

<form id="form1" action="paymentcatch.aspx" method="post">

<input id="wtf" type="text" value="thisisnotworking" />


<input id="Submit1" type="submit" value="submit" />

</form>



Page 2 is ASPX (c#). On the page load I want to read the value from the
hidden input on Page1.

I'm trying to read the hidden input like this: Reques.Form["wtf"]

Everytime the result is null. Has anyone else had this issue?

Thanks In Advance
Scott
 
S

Scott Durrett

Karl,

You were correct :) it's working now. The problem is when I was trying
everything I had changed my action from Post to Get... and never changed it
back. So back to the main problem. I was missing the Name tag.

Thanks
Scott



"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:[email protected]...
forms are submitted based on the NAME field, not the IDfield..

try
<input id="wtf" name="wtf" type="text".../>

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


Scott Durrett said:
I have 2 pages. Page1 is a .html page with a form, hidden input, and a
submit button. I have the action set to Post.

<form id="form1" action="paymentcatch.aspx" method="post">

<input id="wtf" type="text" value="thisisnotworking" />


<input id="Submit1" type="submit" value="submit" />

</form>



Page 2 is ASPX (c#). On the page load I want to read the value from the
hidden input on Page1.

I'm trying to read the hidden input like this: Reques.Form["wtf"]

Everytime the result is null. Has anyone else had this issue?

Thanks In Advance
Scott
 
J

Juan T. Llibre

Hi, Scott.

You can find out real easy by using Request.Params.

Run this :
---------
requestparams.aspx
---------
<%@ Page Language="C#"%>
<script runat="server">
private void Page_Load(object sender, EventArgs e)
{
string paramInfo = "";
NameValueCollection pColl = Request.Params;
for(int i = 0; i <= pColl.Count - 1; i++)
{
paramInfo += "Key: " + pColl.GetKey(i) + "<br>";

string[] pValues = pColl.GetValues(i);

for(int j = 0; j <= pValues.Length - 1; j++)
{
paramInfo += "Value:" + pValues[j] + "<br><br>";
}
}
lblValues.Text = paramInfo;
}
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Label id="lblValues" runat="server" />
</form>
</body>
</html>
----------

That will iterate through all the request parameters.

If you use : <input id="wtf" name="wtf" type="text".../>

You could also, simply use :

Page.Request.Params["wtf"];





Scott Durrett said:
Karl,

Thank for the suggestion. Looks like the Request object is coming in blank on my aspx catch page.
I cannot figure this darn thing out. :)

Scott



Karl Seguin said:
forms are submitted based on the NAME field, not the IDfield..

try
<input id="wtf" name="wtf" type="text".../>

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


Scott Durrett said:
I have 2 pages. Page1 is a .html page with a form, hidden input, and a submit button. I have
the action set to Post.

<form id="form1" action="paymentcatch.aspx" method="post">

<input id="wtf" type="text" value="thisisnotworking" />


<input id="Submit1" type="submit" value="submit" />

</form>



Page 2 is ASPX (c#). On the page load I want to read the value from the hidden input on Page1.

I'm trying to read the hidden input like this: Reques.Form["wtf"]

Everytime the result is null. Has anyone else had this issue?

Thanks In Advance
Scott
 
Joined
Nov 27, 2008
Messages
1
Reaction score
0
Only have ID fields

I am getting a plain HTML form submitted to my aspx page using POST, and the input controls only have the id field, the name field is blank. Is there any way to get the field data by id in ASP .NET.

Thanks,

Harris
 
Last edited:

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,996
Messages
2,570,237
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top