Drupal 5.x does not support HTML image inputs (<image type="input" src="..."/>) out of the box. A common solution to this limitation is to provide your own theming function to handle any buttons you want to turn into images, as described at http://drupal.org/node/144758.
This approach works quite well for simple forms with single submit buttons, but if you're relying on the button's op value to drive conditional logic in the form's _submit function (for example, a multistep-form with previous/next buttons,) you will run afoul of a limitation of Internet Explorer 6 and Internet Explorer 7.
It turns out that when you submit a form by clicking on an image input in IE, the browser does not send that button's value as part of the HTTP request! If you have a switch block that tests for each possible image button's value, it will fall through to the default case every single time when the user's browser is IE6 or IE7. This was a particularly mystifying problem when I first encountered it. I didn't happen to have a fully-configured installation of Eclipse with a PHP debugger set up in my Windows testing environment, so I fell back to using drupal_set_message() to dump debugging information to the screen.
Specifically, I wanted to see exactly what data was being sent from the browser when the user clicked those image buttons, so I used PHP's built-in php://input stream to grab the raw POST data, split the key-value pairs apart on the '&' character, and display one pair per line:
$raw_post = file_get_contents('php://input');
$post_array = explode('&', $raw_post);
drupal_set_message('<pre>' .print_r($post_array, TRUE). '</pre>'); As soon as I compared submissions from FireFox and Safari (where my multi-step form worked) with submissions from Internet Explorer (where it was completely broken) I immediately saw that the missing op value was the culprit, and a bit of searching quickly confirmed that this is a known limitation of IE.
The solution? I wound up tearing out the custom theming code. The inputs all reverted to plain old <input type="submit"/> buttons, and I styled them with CSS as described in the comments section on the discussion at http://drupal.org/node/51526.


IE8
What is it with IE8? Have you encountered any problems?
Great article, i was reading
Great article, i was reading something similar on another website that i was researching. I will be sure to look around more. thanks...


real good job
Yes, Realy it’s very useful information for all of us. Thanks for providing us this information.
nsr slot
ah ha! I was having this
ah ha! I was having this exact same issue with IE. Thanks for the link to the comments section as well, as that got me exactly where I needed to go.
Post new comment