Internet Explorer is sending the wrong button

I have an HTML form with two buttons:


<input type="submit" name="confirm" value="Yes, Delete"  />
<button name="confirm" type="button" onclick="history.back()" value="No, Go Back" >No, Go Back</button>

      

Now when I click either in Firefox, the behavior is as expected. If I click the Submit button, the Yes, Delete message appears, and if I click No, Come Back, it’s like I’m pressing the Back button in my browser. However, in Internet Explorer (6 or 8), if I click the "Yes, remove" button, the message "No, return" appears. Why is this?

+1


source to share


4 answers


Firefox, Safari, Chrome, Opera all play , the first match wins game , but IE plays the last match game.

( see bug report / features here )



In general, I would name the buttons differently if they are not part of the radio / flags set.

+4


source


Because the control named "confirm" has the value "No, Go Back".



+2


source


Just FYI. There are problems with having more than one item <button>

in Internet Explorer (even IE7). You can find it here and here .

I discovered this while trying to create a Save / Update / Delete page with three elements <button>

- worked fine in Firefox ...

+2


source


I believe this is because the names of both buttons are the same. The second button should be "overriding" the attributes of the first button. Anyway, changing the name of the second button solved the problem.

0


source







All Articles