More IE Wierdness

grantm on 2003-11-25T01:04:30

A while ago, matts wrote in his journal about strange IE behaviour. Coincidentally, at the time I'd just been researching the same area and concluded that IE's behaviour made sense and it was Mozilla that seemed to be misbehaving. I've just been researching this a bit more and thought another datapoint or two might be in order. First a couple of links:

I have now revised my conclusion. I repeatedly encountered statements to the effect that the reason Mozilla behaves the way it does, is for compatibility with IE. This made no sense to me since in my tests the two browsers behaved differently. The thing I was missing was that IE's behaviour depends on how many text entry fields are in the form:

  • IE, one text field: send nothing
  • IE, multiple text fields: send name=value of 'first' button
  • Mozilla, one text field: send name=value of 'first' button
  • Mozilla, multiple text fields: send name=value of 'first' button

Clearly IE's behaviour is bizarrely inconsistent after all. Unfortunately Mozilla's behaviour is also inconsistent since (as Dom pointed out) form.submit() does not cause a button value to be sent. The 'correct' behaviour would seem to be 'only send a button value if a button is actually pressed'. Unfortunately, no one does that (Opera works the same as Mozilla).

So, to sum up:

  1. Even if your submit button has a name, your server-side script can't assume the named parameter will be sent
  2. Even if your script receives a button name+value, you can't assume the user actually clicked that button