[development] Form element wrapper IDs
E.J. Zufelt
lists at zufelt.ca
Sat Jan 2 11:36:06 UTC 2010
Good evening,
I believe that radios and checkboxes are wrapped in theme_radios and
theme_checkboxes respectively.
You should be able to override the functions to add the required IDs.
I agree that a core bug should be filed against this.
HTH,
Everett
Follow me on Twitter
http://twitter.com/ezufelt
View my LinkedIn Profile
http://www.linkedin.com/in/ezufelt
On 2-Jan-10, at 5:54 AM, Martin Stadler wrote:
> Hi!
>
> I stumbled upon the issue that there are no form element wrapper IDs
> for radios and checkboxes without the #title or #description
> attributes in D6 (http://drupal.org/node/215301). I need an ID to
> hide the label with CSS for accessability. I checked how this is in
> D7 and it seems to me that there are no wrapper IDs at all, only
> classes which are in the case of radios and checkboxes not unique (I
> know that classes are not supposed to be unique, that's why I want
> IDs):
>
> <div class="form-item form-type-radios form-item-myformelem">
> <label>My Form Element </label>
> <div class="form-radios">
> <div class="form-item form-type-radio form-item-myformelem">
> <input type="radio" id="edit-myformelem-0" name="myformelem"
> value="0" checked="checked" class="form-radio" />
> <label class="option" for="edit-myformelem-0">Option 1 </label>
> </div>
> <div class="form-item form-type-radio form-item-myformelem">
> <input type="radio" id="edit-myformelem-1" name="myformelem"
> value="1" class="form-radio" />
> <label class="option" for="edit-myformelem-1">Option 2 </label>
> </div>
> </div>
> </div>
>
> In modern browsers this may be ok but in IE6 I can't access the
> wrapper div nor the top label directly.
>
> If #title is omitted in the PHP form api code then we get
>
> <div class="form-radios">
> <div class="form-item form-type-radio form-item-myformelem2">
> <input type="radio" id="edit-myformelem2-0" name="myformelem2"
> value="0" checked="checked" class="form-radio" />
> <label class="option" for="edit-myformelem2-0">Option 1 </label>
> </div>
> <div class="form-item form-type-radio form-item-myformelem2">
> <input type="radio" id="edit-myformelem2-1" name="myformelem2"
> value="1" class="form-radio" />
> <label class="option" for="edit-myformelem2-1">Option 2 </label>
> </div>
> </div>
>
> How can I style this individual wrapper now? I may have multiple
> radios in my form.
>
> Actually the problem is the same in D6 and D7. In D6 we have wrapper
> IDs but not for radios and checkboxes and in D7 we have kind of
> unique classes for the wrappers but these are not unique for radios
> and checkboxes. Why were the wrapper IDs removed in D7? Pseudo-
> unique classes seem strange to me. How can we have a unique accessor
> for wrappers for radios and checkboxes? Can we add the wrapper IDs
> for them in D6? Why were these wrapper IDs unset in D6?
>
> Martin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100102/0d0f7230/attachment-0001.html
More information about the development
mailing list