Request.Form(var) empty with IE, works fine with Firefox. Help please.

D

Dave

Hi,

I've been trawling the web for answer to my problem with no luck
although I'm hardly alone it seems!

Below is the generated source for an ASP page that posts a value called
'album' to another ASP page. The other page retrieves the value with
Request.Form('album'); On Firefox this works fine every time. On IE6, I
always get nothing. I'm pretty sure it's the posting side that is at
fault, so that's what I've shown here. Oh, I tried Request.QueryString
too and again, fine on Firefox, nothing on IE6.

Any help would be much appreciated.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Gallery</title>
<!--mstheme-->
<link rel="stylesheet" type="text/css"
href="_themes/poetic2/poet1011.css">
<meta name="Microsoft Theme" content="poetic2 1011, default">
</head>
<body>
<form name='albumselect' action="gallery_intro.asp" method="post"
target="intro">
<CENTER><h2>ALBUMS</h2></CENTER><hr><br>
<CENTER><input name='album' type=image src='photogallery/Test
One/Title.jpg' value='photogallery/Test One'
onClick='submit();'></CENTER>
<CENTER>Test One Photos</CENTER><br><hr><br>
<CENTER><input name='album' type=image src='photogallery/Test
Two/Title.jpg' value='photogallery/Test Two'
onClick='submit();'></CENTER>
<CENTER>Test Two Photos</CENTER><br><hr><br>
<CENTER><input name='album' type=image src='photogallery/Test
Three/Title.jpg' value='photogallery/Test Three'
onClick='submit();'></CENTER>
<CENTER>Test Three Photos</CENTER><br><hr><br>
</form>
</body>
</html>

Regards,

Dave
 
R

Ray Costanzo [MVP]

Can you give your ASP code? Also, what's "submit()?" An <input
type="image"> will submit the form when clicked already.

Ray at work
 
B

Bob Barrows [MVP]

Dave said:
Hi,

I've been trawling the web for answer to my problem with no luck
although I'm hardly alone it seems!

Below is the generated source for an ASP page that posts a value
called 'album' to another ASP page. The other page retrieves the
value with Request.Form('album'); On Firefox this works fine every
time. On IE6, I always get nothing. I'm pretty sure it's the posting
side that is at fault, so that's what I've shown here.

If so, a client-side newsgroup would have been more appropriate (ASP only
concerns server-side activity). But, read on ...
Oh, I tried
Request.QueryString too and again, fine on Firefox, nothing on IE6.

Any help would be much appreciated.

In the future, when posting html, remove everything that's not related to
reproducing the problem, please. For example, we have no access to your
style sheets, etc. so there's no need to show us those tags. Further: you
have three image inputs with the same name. Does the problem only occur when
you have more than one input with the same name?

Here is my attempt to reproduce your problem (and yes, I did test the
difference between one and more than one input):
<%@ Language=VBScript %>
<%
if Request.Form.Count> 0 then
Response.Write "Request.Form(""album.x"") contains<br>"
Response.Write Request.Form("album.x") & "<br>"
Response.Write "Request.Form(""album.y"") contains<br>"
Response.Write Request.Form("album.y") & "<br>"
else
Response.Write "No Form variables"
end if
%>
<HTML>
<BODY>
<form name='albumselect' method="post">
<CENTER><h2>ALBUMS</h2></CENTER><hr><br>
<CENTER><input name='album' type=image src='images/vba3626.gif'
value='photogallery/Test One'
onClick='albumselect.submit();'></CENTER>
<CENTER>Test One Photos</CENTER><br><hr><br>
<CENTER><input name='album' type=image
src='images/vba3626_2.gif' value='photogallery/Test Two'
onClick='albumselect.submit();'></CENTER>
<CENTER>Test Two Photos</CENTER><br><hr><br>
<CENTER><input name='album' type=image
src='images/vba3626.gif' value='photogallery/Test Three'
onClick='albumselect.submit();'></CENTER>
<CENTER>Test Three Photos</CENTER><br><hr><br>
</form>
</BODY>
</HTML>


Everything works as expected. What are you doing differently? Are you
attempting to get the value propert? If so, the online docs at msdn state:

The x-coordinate is submitted under the name of the control with .x
appended, and the y-coordinate is submitted under the name of the control
with .y appended. Any value property is ignored.
 
M

McKirahan

Dave said:
Hi,

I've been trawling the web for answer to my problem with no luck
although I'm hardly alone it seems!

Below is the generated source for an ASP page that posts a value called
'album' to another ASP page. The other page retrieves the value with
Request.Form('album'); On Firefox this works fine every time. On IE6, I
always get nothing. I'm pretty sure it's the posting side that is at
fault, so that's what I've shown here. Oh, I tried Request.QueryString
too and again, fine on Firefox, nothing on IE6.

Any help would be much appreciated.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Gallery</title>
<!--mstheme-->
<link rel="stylesheet" type="text/css"
href="_themes/poetic2/poet1011.css">
<meta name="Microsoft Theme" content="poetic2 1011, default">
</head>
<body>
<form name='albumselect' action="gallery_intro.asp" method="post"
target="intro">
<CENTER><h2>ALBUMS</h2></CENTER><hr><br>
<CENTER><input name='album' type=image src='photogallery/Test
One/Title.jpg' value='photogallery/Test One'
onClick='submit();'></CENTER>
<CENTER>Test One Photos</CENTER><br><hr><br>
<CENTER><input name='album' type=image src='photogallery/Test
Two/Title.jpg' value='photogallery/Test Two'
onClick='submit();'></CENTER>
<CENTER>Test Two Photos</CENTER><br><hr><br>
<CENTER><input name='album' type=image src='photogallery/Test
Three/Title.jpg' value='photogallery/Test Three'
onClick='submit();'></CENTER>
<CENTER>Test Three Photos</CENTER><br><hr><br>
</form>
</body>
</html>

Strip it down and you have:
<input name='album' type=image
three times!

Which is your
Request.Form('album');
supposed to reference?

Of course, were seeing the generated code not the ASP page...

Strip the calling and called pages down to the minimum
then test them; if there's still a problem then post them.
 
D

Dave

Hi Ray,

Thanks for responding. The ASP is below. As another exercise I did a
view source from both firefox and IE6 to compare them. Whether this is
merely a difference in the two "view source" implementations I don't
know but in the Firefox one, the single quotes around 'album' had been
changed to double quotes ("album") and the strings for img src had been
'translated', ie the spaces changed to %20.

eg: Firefox says:

<center><input name="album" src="photogallery/Test%20One/Title.jpg"
value="photogallery/Test One" onclick="submit();"
type="image"></center>

but IE6 says:

<center><input name='album' src='photogallery/Test One/Title.jpg'
value='photogallery/Test One' onclick=submit();' type='image'></center>

Probably a red herring but I thought I'd mention it.

The ASP code for this is:

------------------------------------------------------------------
<%@ Language=JavaScript %>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Gallery</title>
<meta name="Microsoft Theme" content="poetic2 1011, default">
</head>

<body>

<form name='albumselect' action="gallery_intro.asp" method="post"
target="intro">
<CENTER><h2>ALBUMS</h2></CENTER><hr><br>

<SCRIPT LANGUAGE="JavaScript" RUNAT="Server">

var fso, f, fc, fs, so, tl;
var fullpath, fsr;

fso = new ActiveXObject("Scripting.FileSystemObject");

fullpath = Server.MapPath("photogallery");

f = fso.GetFolder(fullpath);
fc = new Enumerator(f.SubFolders);

for (; !fc.atEnd(); fc.moveNext())
{
fs = fc.item().Path;
so = fso_OpenTextFile(fs + "/Title.txt", 1, 0);
tl = so.ReadLine();
so.Close();

fs = fc.item().Name;
fsr = "photogallery/" + fs.toString();
Response.Write("<CENTER><input name='album' type=image src='" + fsr +
"/Title.jpg' value='" + fsr + "' onClick='submit();'></CENTER>");
Response.Write("<CENTER>" + tl + "</CENTER><br><hr><br>");
}

Response.Write("</form></body></html>");

</SCRIPT>
------------------------------------------------------------------

I'm now really hoping you look at this and go "Ah Ha!!!".

As for the submit(): According to my documentation, its required to
make the form submit when you click the pic. Perhaps it one of those
optional bits.

Dave
 
D

Dave

I've posted the ASP now. I tried it with just one entry instead of
three. Same problem.

With Firefox, the Request.Form correctly references the instance of
'album' that was clicked.

Thanks for the thought though.

Dave
 
D

Dave Anderson

Dave said:
On Firefox this works fine every time. On IE6, I always
get nothing.

<input name='album' type=image ...>

If you simply tried this, you would understand the issue entirely:

Response.Write(Request.Form)



In short, INPUT TYPE="image" elements send .x and .y values. According to
MSDN, VALUE is not a valid property of this element:

http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/input_image.asp
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/value_1.asp

This appears to conflict somewhat with the HTML specification:
http://www.w3.org/TR/html401/interact/forms.html#adef-value-INPUT

If you want to know which image input was clicked, you need unique names,
and then you can do this:

JScript:
if (Request.Form("input_name.x").Count) ...

VBScript:
If Request.Form("input_name.x").Count > 0 Then ...
 
D

Dave Anderson

I said:

I should add that this behavior (not sending the name-value pair) remains
the same under IE7.

And to clarify my comment about a conflict with the specification, I think
Microsoft and Mozilla interpret the recommendation differently. There is
wriggle room, too, since the recommendation does not define image controls
as Control Types, which directly refutes the notion that they could be
Successful Controls:

http://www.w3.org/TR/html401/interact/forms.html#h-17.2.1
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2


FWIW, Opera behaves like IE on this matter.
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top