(I tried using the extended characters to show the code here, but Graymatter is converting it automatically, which is annoying. So look at the code.)
This shows the ideal section of a select field in a form. The intersting thing here that isn’t really used much (at all? Ever?) is the Optgroup. I know that NS doesn’t display this at all. But it ignores it nicely, which is something at least. IE displays this nicely.
Your dropdown will look something like the following:
Title for Grouping 1
Option 1
Option 2
Title for Grouping 2
Option 3
Option 4
Nice, eh?
What it does is take your insanely long or convoluted select boxes, and groups them according to the hierachies you define. HTML 4.0 DOES NOT allow nesting of the optgroup. To quote the W3C HTML 4.0 Spec:
“Implementors are advised that future versions of HTML may extend the grouping
mechanism to allow for nested groups (i.e., OPTGROUP elements may nest) as
shown in the above example. This will allow authors to represent a richer
hierarchy of choices.”
The other stuff, labels, fieldsets, legends are common field items that should be used more often, as they are a great boon accessibility-wise.
Tagged As Coding
Comments are Open (0)
Posted at 12:00 PM