E-mail List Archives

Re: labels in forms

for

From: Jared Smith
Date: May 31, 2007 11:50PM


On 5/31/07, Jukka K. Korpela < <EMAIL REMOVED> > wrote:
> This _is_ nitpicking when form fields are considered, since there is
> hardly any point in referring to a field with a fragment identifier. But
> for id attributes in general, it is a good idea to keep them reasonably
> readable to humans.

And this is _really_ nitpicking, but the fragment identifier/id for
links could be useful if you're providing a link directly to the form
element, primarily for the sake of error recovery. The fragment
identifier in the URL can be a bit helpful to the end user. The id can
also be used in scripting for form validation or error recovery. So,
as Jukka says, your life will be easier if you make them readable and
provide some association to the element in question.

Also of note, values for id must be unique - the same one can't appear
twice on any given page. They also must start with an ASCII letter
(NOT a number), followed by any number of ASCII letters, digits,
hyphens, underscores, colons, and periods. If you're using the ID for
CSS, you should be careful with the use of underscores. Colons and
periods will cause issues with scripting and CSS. The id value and
references to it are also _supposed_ to be case sensitive.

Jared