You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Karr, David" <da...@wamu.net> on 2004/12/21 01:18:29 UTC
Workaround for IE not sending "value" on input image tag?
This isn't strictly a Struts question, but I may have to manipulate the
Struts tags to get around this problem.
I have some code that uses "html:image" to form an image submit button.
I don't care about the click coordinates, I just care about the request
parameter from the "name" parameter.
This code works fine when run in FireFox.
Unfortunately, I find that IE doesn't send a request parameter named by
the "name" attribute. A quick google for this confirms this somewhat
vaguely.
For instance, my "input" tag looks like the following. When I run this
in FireFox, I get a request parameter named "submitMethod", with the
value "abc". In IE, I don't see a "submitMethod" request parameter.
Both browsers produce the ".x" and ".y" parameters, which I don't care
about.
<input type="image" name="submitMethod"
src="/inputbug/images/delete.gif" value="abc">
Is there a standard way of getting around this problem? Is there a
better place to ask questions like this?
___________________________________________________
David M. Karr, Technical Specialist II
TSG Data Delivery and Integration Services
Enterprise Application Integration (EAI)
Washington Mutual
1201 Third Avenue, WMT0914, Seattle, WA 98101
www.wamu.com
206.490.7289 direct | 206.909.0664 mobile
206.490.2262 fax
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Workaround for IE not sending "value" on input image tag?
Posted by Neil Erdwien <ne...@k-state.edu>.
How about triggering off the submitMethod.x name's existance. You don't
care about what the value is, but the mere existance should work.
Karr, David wrote:
> This isn't strictly a Struts question, but I may have to manipulate the
> Struts tags to get around this problem.
>
> I have some code that uses "html:image" to form an image submit button.
> I don't care about the click coordinates, I just care about the request
> parameter from the "name" parameter.
>
> This code works fine when run in FireFox.
>
> Unfortunately, I find that IE doesn't send a request parameter named by
> the "name" attribute. A quick google for this confirms this somewhat
> vaguely.
>
> For instance, my "input" tag looks like the following. When I run this
> in FireFox, I get a request parameter named "submitMethod", with the
> value "abc". In IE, I don't see a "submitMethod" request parameter.
> Both browsers produce the ".x" and ".y" parameters, which I don't care
> about.
>
> <input type="image" name="submitMethod"
> src="/inputbug/images/delete.gif" value="abc">
>
> Is there a standard way of getting around this problem? Is there a
> better place to ask questions like this?
>
> ___________________________________________________
> David M. Karr, Technical Specialist II
> TSG Data Delivery and Integration Services
> Enterprise Application Integration (EAI)
>
> Washington Mutual
> 1201 Third Avenue, WMT0914, Seattle, WA 98101
> www.wamu.com
>
> 206.490.7289 direct | 206.909.0664 mobile
> 206.490.2262 fax
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Neil Erdwien, neil@k-state.edu, Web Technologies Manager
Computing and Network Services, Kansas State University
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Workaround for IE not sending "value" on input image tag?
Posted by Dakota Jack <da...@gmail.com>.
Hello, David,
You might as well forget about the wonders of firefox and learn to
live for the moment with browsers that merely give you coordinates.
Struts has many solutions to this problem which are in the code, such
as LookupDispatchAction, ImageButtonBean (or something like that) and
so on. All these solutions are built around, in the end, determining
what the value of the image tag submit button is. They are all dated
and not what you need, I think. I use a number of solutions which are
take-offs on the varieties shown at www.michaelmcgrady.com/button .
If you are interested in these more esoteric answers, I would be happy
to send them to you. For the moment, something like the following
works well:
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
public class ImageTagUtil {
public static String getName(HttpServletRequest request) {
String command = null;
String buttonValue = null;
Enumeration enum = request.getParameterNames();
while(enum.hasMoreElements()) {
buttonValue = (String)enum.nextElement();
if(buttonValue.indexOf(".method") != -1) {
command = buttonValue.substring(0,buttonValue.indexOf('.'));
}
}
return command;
}
}
All you have to do in this case is change your code to <input
type="image" name="abc.method" src="/inputbug/images/delete.gif"> if
you want to get "abc" as the value of "command". Usually image
buttons are used when you have multiple commands you might want to
use, such as "delete", "submit", "store", etc. So, the code would
normally be something like:
<input type="image" name="delete.method"
src="/inputbug/images/delete.gif" value="abc">
<input type="image" name="save.method" src="/inputbug/images/save.gif">
The variable "command" would be "delete" in the former case and "save"
in the latter. If you really want the value of "value", which you
probably don't, then you can use request.getParameter(command + ".x").
Jack
--
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~
"You can't wake a person who is pretending to be asleep."
~Native Proverb~
"Each man is good in His sight. It is not necessary for eagles to be crows."
~Hunkesni (Sitting Bull), Hunkpapa Sioux~
-----------------------------------------------
"This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation."
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org