1

For some time ago, I heard that using the <button></button> to submit a form, is not good - because IE submits the value of the button instead of the inputs in the form. Is this true.?

Because currently I'm working with bootstrap, and I have this login button, which should contain the arrow icon too. like:

<button type="submit" class="btn btn-primary" name="btnSubmit"> Login <i class="icon-arrow-right"></i> </button> 

I can't see how I should do it with a normal input button :/

Hope someone can answer this question!

Thank you guys!

4
  • Have you tried adding the class="btn btn-primary" attribute to an <input> element? It should apply the same styling. Commented Apr 9, 2012 at 8:05
  • It is true in case IE (which version?!) would violate the HTML 4 specification. It is not true, if IE is compliant). w3.org/TR/REC-html40/interact/forms.html#edef-BUTTON Commented Apr 9, 2012 at 8:05
  • 1
    @hakre — It is a bug in IE, or rather - two. IIRC "All button elements are always successful" was fixed in IE7 and "Button elements submit their content instead of their value attributes" was fixed in IE8 (maybe 9) but only in standards mode. Commented Apr 9, 2012 at 8:11
  • I can add the class btn btn-primary to the input, and it works great.. It's more the <i class="icon-arrow-right"></i> I want to include too, because according to SMACCSS and Bootstrap, it's the best way to include icons :) Commented Apr 9, 2012 at 9:46

2 Answers 2

2

It is only a problem if you need to have multiple submit buttons and differentiate between them on the server.

If you do and you need to support IE6 then you should avoid using <button> elements, and they will all always be successful controls.

If you need to support IE7 (and possibly IE8) then you can give them unique names and test on the server to see which name appears in the data (while ignoring the value completely).

Sign up to request clarification or add additional context in comments.

1 Comment

I only need support, for IE7,8,9 I will try messing around with it to see whats happen, when I get back to a windows computer.
0

just use input. CSS-stylings work the same way for inputs. You cann also address the button with in your css:

.btn_primary input[type="submit"] 

which works in gte ie6.

HTML

<input type="submit" name="btnSubmit" class="btn btn_primary" /> 

2 Comments

It wasn't exactly my question sorry.. The styling of the input works great, but it's the <i></i> tag I should have included.
sry, my mistake! Working with one background-image would be another solution, a backgroundimage including the icon. Thats the way i style all my submit buttons

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.