W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2007

[whatwg] [WF2] <button> without value="" should perhaps use .innerText as value

From: Simon Pieters <zcorpan@gmail.com>
Date: Sat, 14 Apr 2007 03:10:07 +0200
Message-ID: <op.tqq1i5sz7a8kvn@hp-a0a83fcd39d2>
We currently don't have interop with IE and other browsers with regards to  
what to send to the server as the value of <button>.

IE always sends .innerText as value.

Other browsers always send the contents of value="" as value, or the empty  
string if it's missing (as per HTML4).

There may be content on the Web relying on IE's behavior, e.g. missing  
value="" attribute. Still, the other browsers agree on using value="" and  
using value="" is useful (in order to send one value to the server but  
show different text to the user as button text), and is the way other form  
controls work.

A middle ground could be to use value="" if the attribute is present, or  
.innerText otherwise (pretty much like <option>).

Test cases for the above proposal:

    <form><button type=submit name=test value=PASS>FAIL</button></form>

    <form><button type=submit name=test>PASS</button></form>

Simon Pieters
Received on Friday, 13 April 2007 18:10:07 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:54 UTC