IE annoyances

Matts on 2003-08-09T13:31:46

I've been developing a web app for the last 6 months (it hasn't really been full time for 6 months, but I started over 6 months ago now) at work. It's just now gone to testing. Testing is interesting, because it's uncovering all sorts of weird issues with developing on non-IE (mostly Safari and Camino), and shipping to testers who all use IE.

The biggest pain right now is what happens in IE when you hit enter in a text field.

See I have a layout like this:

[Button]  [Button]               [SearchEntry] [SearchButton]
 [Checkbox]
 [Checkbox]
   ...
[Button]  [Button]
Now in all browsers apart from IE, when you hit enter in the search entry box, it acts like hitting the first button on the form. But in IE it submits the form as though no buttons at all were clicked (i.e. you get no key/value pairs for any of the buttons). This is extremely weird.

What I really wanted was for hitting enter to act as though the SearchButton was hit. In all non-IE browsers I could achieve this by embedding a form within the outer form. Unfortunately this isn't valid HTML, and IE treats the first close form tag as closing the entire outer form, so IE sees a bunch of checkboxes and two buttons that aren't attached to any form at all. Obviously not good.

So what I'm going to have to do now is hack AxKit's PerForm taglib to pretend as though a button got hit if no button got hit. I guess I'll just pick the first button regardless. Very annoying.


Always have a default

Dom2 on 2003-08-09T14:24:05

I've just discovered that javascript's Form.submit() acts as though no submit button has been pressed (in the multi-submit case). It's probably good to code a default action.

-Dom

Hidden Fields

barbie on 2003-08-09T15:59:36

The way I've generally got around this, is to have a special hidden field in the form. If no button is detected it uses the hidden field value as the default.

Fun one!

krellis on 2003-08-10T20:42:01

We had a fun time hunting this behavior dowh just the other day. If you have two or more input type=text boxes, this behavior suddenly goes away, and it does what you'd expect. One work-around, then, is to have a text box which is disabled, and has a style="display:none" attribute on it. Any browser which supports CSS will not display the field, as if it didn't exist, but IE will now treat the form the way you want it to.

Re:Fun one!

Matts on 2003-08-11T07:11:18

Unfortunately I have to be able to support Linx and Lynx too. :-)

I think I now have a proper fix - a default form submit handler which points to my search routine. I've released AxKit::XSP::PerForm 1.83 to CPAN to deal with this situation.