|
 |
|
Dev Articles Community Forums
> Programming
> ASP Development
|
request.form not working
Discuss request.form not working in the ASP Development forum on Dev Articles. request.form not working ASP Development forum discussing your ASP or Visual Basic problems, solutions and code posts. Active Server Pages help you create dynamic websites using powerful scripting technologies.
|
|
 |
|
|
|
|

Dev Articles Community Forums Sponsor:
|
|
|

February 3rd, 2005, 04:55 PM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 6
Time spent in forums: 37 m 20 sec
Reputation Power: 0
|
|
request.form not working
Hi,
I know it will sound stupid but I have got a very simple problem. I am trying to pass a value from a textbox in a form to another asp page and displaying it there. I am using request.form for that and response.write but request.form is not getting any value from the form and the target asp page does not display any error as well.
The codes for the pages are;
contactus.asp
---------------
<html>
<head>
Hello
</head>
<body>
<form method="post" action="contactusaction.asp">
<input type="text" name="fname"/>
<input type="button" value="Submit"/>
</form>
</body>
</html>
contactusaction.asp
--------------------
<%@ page language="vbscript"%>
<html>
<body>
<%
Dim x
x=Request.Form("fname")
Response.Write(x)
%>
</body>
</html>
Here it is not printing the name. I dont now what to do.
I am using Win XP Pro with SP2.
Please help me.
Ashish
|

February 3rd, 2005, 06:47 PM
|
|
Contributing User
|
|
Join Date: Jan 2005
Posts: 176
Time spent in forums: 1 Day 4 h 20 m 48 sec
Reputation Power: 9
|
|
Hey Ashish...blabla
You have two important mistakes:
1) the second input type should be "submit" not "button". Otherwise, the form is not going anyware
2) get rid of that bloody <%@ page language="vbscript"%>. It's completly unecesary, and crushes the page.
Do that and it should work like a swiss watch!!  (the code is really simple!!)
Good luck
Anibal.
|

February 4th, 2005, 11:42 AM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 6
Time spent in forums: 37 m 20 sec
Reputation Power: 0
|
|
Hi Anibal,
Thanks a lot...i will try that and let u know what happened....i am really stupid......i couldn't see the button type.....
cheers,
ashish
Quote: | Originally Posted by Anibal Hey Ashish...blabla
You have two important mistakes:
1) the second input type should be "submit" not "button". Otherwise, the form is not going anyware
2) get rid of that bloody <%@ page language="vbscript"%>. It's completly unecesary, and crushes the page.
Do that and it should work like a swiss watch!!  (the code is really simple!!)
Good luck
Anibal. |
|

February 7th, 2005, 11:19 AM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 6
Time spent in forums: 37 m 20 sec
Reputation Power: 0
|
|
|
HI Anibal,
I tried what u suggested....but still its the same.....what to do????...Please help me....i am stuck.....
|

February 7th, 2005, 03:15 PM
|
|
Contributing User
|
|
Join Date: Jan 2005
Posts: 176
Time spent in forums: 1 Day 4 h 20 m 48 sec
Reputation Power: 9
|
|
Hi..I don't know what to say!. I've tested your code (with the modifications I gave you) and it works perfectly...Try removing the "/" at the end of the input tag (although it shouldn't change a thing). Also, try using request("fname") instead of request.Form and use the GET method instead of POST (so you can see in the address bar wheather the field is being sent or not  )
If still nothing.... write down an ASP file with only a response.write "hello world" and run it. If it doesn't work, then your server is not processing the ASP files correctly. If it works....you got me there mate!!
Let's see what happens, make sure to let me know...
Anibal.
|

February 8th, 2005, 05:09 AM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 6
Time spent in forums: 37 m 20 sec
Reputation Power: 0
|
|
Hi,
I tried response.write and get method...both are working but request.form is still not working.....do we need any settings in the server....
ashish
Quote: | Originally Posted by Anibal Hi..I don't know what to say!. I've tested your code (with the modifications I gave you) and it works perfectly...Try removing the "/" at the end of the input tag (although it shouldn't change a thing). Also, try using request("fname") instead of request.Form and use the GET method instead of POST (so you can see in the address bar wheather the field is being sent or not  )
If still nothing.... write down an ASP file with only a response.write "hello world" and run it. If it doesn't work, then your server is not processing the ASP files correctly. If it works....you got me there mate!!
Let's see what happens, make sure to let me know...
Anibal. |
|

February 8th, 2005, 08:23 AM
|
|
Contributing User
|
|
Join Date: Jan 2005
Posts: 176
Time spent in forums: 1 Day 4 h 20 m 48 sec
Reputation Power: 9
|
|
Hey Ash...I wouldn't know about that. I've never configured the server myself, I just programm it  . But, look, if request("blabla") works and without .Form(".."), just use it like that. Use:
Dim x
x = request("fname")
response.write x
and that's it. Don't complicate yourself with request.form or request.queryString.....use the method="POST" and request("...."). If request works and response works too, there shouldn't be any problem!!
Good Luck (keep on trying)
Anibal.
|

February 9th, 2005, 06:10 AM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 6
Time spent in forums: 37 m 20 sec
Reputation Power: 0
|
|
|
Hi,
Just request("fname") is not working......i am really cluless what to do.....querystring is working but with that i can not carry large data.....please can u ask someone else who knows more about it.....
cheers,
ashish
|

February 9th, 2005, 12:56 PM
|
|
Contributing User
|
|
Join Date: Jan 2005
Posts: 176
Time spent in forums: 1 Day 4 h 20 m 48 sec
Reputation Power: 9
|
|
|
Hey Ashish...
This is imposible!! I've shown the code to my "guru" and he couldn't belive his eyes! He took the code you posted, placed it on the server and it worked perfectly. He even tried all the solutions I gave you and they all worked. Are you sure you wrote what I told you? Do you see the variables on the address bar after the ".asp?" ? If request.queryString is working, and request.form is not...your form is somehow not correctly placed or something. I've allways used request("...") and never had a problem with it.
Check the server with someone who knows about it...I'd love to help you further, but I'm out of resources here
Good Luck
Anibal.
PS: What Server are you using? You SO?, etc.....
|

February 9th, 2005, 03:40 PM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 6
Time spent in forums: 37 m 20 sec
Reputation Power: 0
|
|
|
Hi Anibal,
Trust me....i have tried whatever you have suggested......i think there is some problem in the server settings which i am not able to figure out......but asp pages are working then could there be any problem in server setting.......I am using IIS5.1....I have also installed .NET Framework......could that be a problem.....
cheers,
ashish
|

February 9th, 2005, 04:34 PM
|
|
Contributing User
|
|
Join Date: Jan 2005
Posts: 176
Time spent in forums: 1 Day 4 h 20 m 48 sec
Reputation Power: 9
|
|
|
Hey ashish...
Wow..That's even more weird!! You basicaly have the same configuration I use!...unfortunatly, I don;t know a bit about it. I'm really sorry mate, I don't know what else to tell you, neither does my guru. If you ever find the problem, just let me know!
Anibal.
|

February 17th, 2005, 04:08 PM
|
 |
May contain nuts.
|
|
Join Date: Aug 2002
Posts: 2,056
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
|
|
Try this script on the page that you are posting to. It'll print out a list of received form items, and their associated values.
Code:
for each f in request.form()
response.write("<p>" & f & " = " & request.form(f) &"</p>")
next
|

March 18th, 2005, 04:03 AM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 1
Time spent in forums: 18 m 26 sec
Reputation Power: 0
|
|
|
I don't believe this!!!
Unbeliavable!
I had the same problem. Tried to debug it for a full day, but nothing helped. Until I came to this forum, and read the comment
"use Request("..") and not Request.Form("..")"
My ASP book uses Request.Form("..") and I haven't had any problems with it before, but now removing the .Field solved the problem.
The funny thing is, that I use the exact same code in another ASP page and it works there just fine with .Field included. (in the same server)
Thank YOU.. You saved my day 
|

July 8th, 2005, 03:03 PM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 1
Time spent in forums: 6 m 12 sec
Reputation Power: 0
|
|
Hi, this is my first post to this forum and the reason I am posting is because I had a similar probleam and got frustrated because I could not find any answers online.
Eventually I solved the problem by trying things I never thought would affect it..
My problem was I had a form that POSTs info to the
next form...easy enough...then request the info on the next
page.. done it a million times and never have problems with
it.
For some reason it would not work for me today!
Eventually I tried removing the enctype="multipart/form data" from my form tag and it worked! Don't know why this is or
why I ever declared an enctype.
According to the code below this is not your problem but I wanted to post this info in case someone is looking for the same problem...
hope this helps.
Quote: | Originally Posted by ashishpisces Hi,
I know it will sound stupid but I have got a very simple problem. I am trying to pass a value from a textbox in a form to another asp page and displaying it there. I am using request.form for that and response.write but request.form is not getting any value from the form and the target asp page does not display any error as well.
The codes for the pages are;
contactus.asp
---------------
<html>
<head>
Hello
</head>
<body>
<form method="post" action="contactusaction.asp">
<input type="text" name="fname"/>
<input type="button" value="Submit"/>
</form>
</body>
</html>
contactusaction.asp
--------------------
<%@ page language="vbscript"%>
<html>
<body>
<%
Dim x
x=Request.Form("fname")
Response.Write(x)
%>
</body>
</html>
Here it is not printing the name. I dont now what to do.
I am using Win XP Pro with SP2.
Please help me.
Ashish |
|

April 28th, 2006, 07:47 PM
|
|
Registered User
|
|
Join Date: Apr 2006
Posts: 2
Time spent in forums: 2 h 1 m 42 sec
Reputation Power: 0
|
|
|
I have exactly the same problem as ashish. Please help.
|

March 5th, 2008, 05:17 AM
|
|
Registered User
|
|
Join Date: Mar 2008
Posts: 1
Time spent in forums: 16 m 59 sec
Reputation Power: 0
|
|
|
Eurica
Hi All
Had a very frustrating day but in the end I added the lines:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
before the <html> tag and
<meta http-equiv="content-type" content="text/html; charset=windows-1255">
in the <head> section
(You should change the charset to what your site works with)
And
TADA!!!!!!!
|

July 18th, 2008, 10:06 AM
|
|
Registered User
|
|
Join Date: Jul 2008
Posts: 1
Time spent in forums: 2 m 43 sec
Reputation Power: 0
|
|
|
Fixed it!
Hey guys,
I had the same problem, but my fix was very simple. I was using id="inputname" instead of name="inputname", I added name in addition to id on all inputs and now it works for me. Hopefully this helps someone. 
|

March 31st, 2010, 04:22 PM
|
|
Registered User
|
|
Join Date: Mar 2010
Posts: 1
Time spent in forums: 7 m 53 sec
Reputation Power: 0
|
|
|
nn
i know this is really old but i just had the same issue and found out it could be related to a known microsoft issue. this is only an issue when using Internet Explorer and using anonymous access.
when posting from a form page what has anonymous access the request.form() does not work in IE, but seems to be fine in Firefox.
In case anyone else was interested...
xD
|

April 7th, 2010, 02:53 PM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 1
Time spent in forums: 12 m 59 sec
Reputation Power: 0
|
|
|
I am having the exact same issue, and it seems to have started just today.
I've tried all the solutions posted above and none seem to work. It doesn't work in either IE or FF.
What's strange is that it doesn't seem to be an issue of whether you use Request or Request.Form, because that isn't what is throwing the error. It is the fact that the form method is POST rather than GET.
For example, if my form method is GET, and I use Request("FormField"), it works no problem.
If my form method is POST, and I use the exact same Request("FormField), it does not work anymore.
Another strange thing is that on the exact same server, we have the same code in another site under the same IIS, and it works there!! Driving me crazy. It must be some setting within that site in IIS, but I just can't figure out what it is.
Some more information I found in the logs:
When I use method GET, the log entries in IIS look normal. When I use method POST, I see something like this:
POST /login/logintest.asp |11|80004005|
80004005 must be an error code, because I found this page:
classicasp.aspfaq.com/general/why-do-i-get-non-database-related-80004005-errors.html
I'm sifting through it right now, but haven't found anything that's helped me so far.
EDIT: It is now working!
Ok, so admittedly I'm not exactly sure what got it to work, but I'll tell you the steps I was doing when it suddenly started working again.
1. Restarted IIS - still didn't seem to work
2. In IE, I right-clicked on the page with my form, then selected Encoding > Unicode (UTF-8). The encoding had been pre-selected to be Western European (Windows).
3. After I did that, the form started working for me, in both IE and FF. I was able to submit and see the result of my Request.Forms.
4. I tried switching the Encoding back to Western European (Windows) and it continued to work. Also worked with Western European (ISO) and Unicode still.
5. I told a colleague of mine to just go to the form and submit to see the error, but suddenly she wasn't seeing the error anymore. I asked her to check her encoding, which she hadn't changed, and it was Western European (Windows).
6. So suddenly it is working for all other users too. I have no idea how that could be, but it is working. Didn't have to have them change their Encodings or anything else. So strange!
|

November 25th, 2012, 12:31 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 2
Time spent in forums: 24 m 10 sec
Reputation Power: 0
|
|
had response to the following code as <% Dim x x=Request.Form("fname") Response.Write(x) %>
<html>
<head>
Hello
</head>
<body>
<form method="POST" action="saha2.asp">
<input type="text" name="fname"/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
sah2
____________
<html>
<body>
<%
Dim x
x=Request.Form("fname")
Response.Write(x)
%>
</body>
</html>
PLEASE HELP 
|

November 27th, 2012, 09:02 PM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 2
Time spent in forums: 24 m 10 sec
Reputation Power: 0
|
|
maybe
got the anser  wasnt using localhost to view the asp file from browser
|

November 29th, 2012, 07:09 PM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 6
Time spent in forums: 8 m
Reputation Power: 0
|
|
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|