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

[whatwg] Can we make checkboxes readonly?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 6 Apr 2011 15:46:42 -0700
Message-ID: <BANLkTikC8eSi4p7uAVEArVDom6=YC35oQQ@mail.gmail.com>
On Wed, Apr 6, 2011 at 3:39 PM, Lachlan Hunt <lachlan.hunt at lachy.id.au> wrote:
> On 2011-04-07 00:28, Tab Atkins Jr. wrote:
>>
>> On Wed, Apr 6, 2011 at 3:12 PM, Lachlan Hunt<lachlan.hunt at lachy.id.au>
>> ?wrote:
>>>
>>> What's wrong with using disabled?
>>>
>>> <input type="checkbox" disabled>
>>> <input type="checkbox" disabled checked>
>>
>> Disabled elements don't participate in form submission.
>
> That's true, but if the controls are readonly, then the user can't change
> the value and so why does that matter? ?Could you clarify the use case for
> having a readonly checkbox value submitted?

An app may dynamically set inputs or groups of inputs to readonly
based on app state.  When you submit, though, it's impossible to tell
(without hacks) whether a checkbox was checked-but-disabled or just
unchecked.  Handling the form data is *much* easier if you just get
all the data, regardless of whether, as a UI convenience, your app
temporarily set some of the inputs to readonly.

~TJ
Received on Wednesday, 6 April 2011 15:46:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:03 GMT