<button type="submit"> compatibility?

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2010-04-06T06:52:42Z Indexed on 2010/04/06 6:53 UTC
Read the original article Hit count: 157

Filed under:

I'd like to have a submit button that submits a different value than is displayed on the button. With <input type="submit"> you can't seem to do this. With <button type="submit"> however, these can be two different values. The question is, will it work in all browsers?

Trying this test code here:

<form method="get" action="">
    <input type="text" name="txt"/>
    <button type="submit" name="btn" value="val">text</button>
</form>

In FF 3.6 it updates my address bar with both values appropriately (and responds to me pressing enter in the text box). In IE 8, it also accepts pressing enter, displays the text value in the address bar, but it show the button's value as a GET param at all... does that mean it's not submitting it?

© Stack Overflow or respective owner

Related posts about html