By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,106 Members | 1,080 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,106 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Sep 1 '06 #1
Share this Question
Share on Google+
9 Replies


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

Ray at work

"Dave" <da**@seafaretech.co.ukwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
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

Sep 1 '06 #2

P: n/a
Dave wrote:
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.Count0 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.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Sep 1 '06 #3

P: n/a
"Dave" <da**@seafaretech.co.ukwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
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.
Sep 1 '06 #4

P: n/a
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

Ray Costanzo [MVP] wrote:
Can you give your ASP code? Also, what's "submit()?" An <input
type="image"will submit the form when clicked already.

Ray at work
Sep 1 '06 #5

P: n/a
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

McKirahan wrote:
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.
Sep 1 '06 #6

P: n/a
Dave wrote:
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/a...nput_image.asp
http://msdn.microsoft.com/workshop/a...es/value_1.asp

This appears to conflict somewhat with the HTML specification:
http://www.w3.org/TR/html401/interac...ef-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 ...

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Sep 1 '06 #7

P: n/a
"Dave" <da**@seafaretech.co.ukwrote in message
news:11**********************@74g2000cwt.googlegro ups.com...
I've posted the ASP now.
[snip]

Where?
Sep 1 '06 #8

P: n/a
I wrote:
According to MSDN, VALUE is not a valid property of this element:

http://msdn.microsoft.com/workshop/a...nput_image.asp
http://msdn.microsoft.com/workshop/a...es/value_1.asp

This appears to conflict somewhat with the HTML specification:
http://www.w3.org/TR/html401/interac...ef-value-INPUT
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/interac....html#h-17.2.1
http://www.w3.org/TR/html401/interac...html#h-17.13.2
FWIW, Opera behaves like IE on this matter.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Sep 1 '06 #9

P: n/a
Mr Anderson, you're a star. Many many thanks.

Dave

Dave Anderson wrote:
I wrote:
According to MSDN, VALUE is not a valid property of this element:

http://msdn.microsoft.com/workshop/a...nput_image.asp
http://msdn.microsoft.com/workshop/a...es/value_1.asp

This appears to conflict somewhat with the HTML specification:
http://www.w3.org/TR/html401/interac...ef-value-INPUT

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/interac....html#h-17.2.1
http://www.w3.org/TR/html401/interac...html#h-17.13.2
FWIW, Opera behaves like IE on this matter.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Sep 1 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.