WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: "Disabled" vs. "Read-only"

for

From: Jukka K. Korpela
Date: Jan 4, 2008 2:10PM


Steve Green wrote:

> One solution is to display the data as plain text rather than as a
> form control. It may take a bit more coding but it would solve all
> your problems from the user's perspective.

Right. It would avoid the risk of being understood as something that the
user should modify. (It can be frustrating to see something that you
recognize as input field but find yourself unable to do anything about.)

> If the data cannot be
> changed, I can't see why it would need to be a form control.

Except that it might be data being passed through the form, typically
from one form submission to another. This is probably not the case if a
disabled field now works functionally (since disabled fields are not
part of the form data), but if you have a readonly field, then it is
included in the form data. And if it _needs_ to be in the data, you just
have to use an <input type="hidden" ...> field. It simply adds to the
form data, without affecting the form rendering. If you also need to
present that data to the user, you simply use normal content for that.
This means data duplication, like

Name: John Doe
<input type="hidden" name="name" value="John Doe">

but that's not big problem, especially if you're generating the form
dynamically, as you probably are in this scenario.

Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/