Request.form isn't working

  • Thread starter Thread starter Scott Durrett
  • Start date Start date
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
 
forms are submitted based on the NAME field, not the IDfield..

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

Karl
 
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
 
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
 
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"];




Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
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
 

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

Back
Top