• Post Reply Bookmark Topic Watch Topic
  • New Topic

SelectItem and labels  RSS feed

Pat McCabe
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I have a requirement that the radio buttons in our application are able to be toggled by their label. I believe the standard HTML for this according to W3Schools is as follows:

<input type="radio" id="blah" name="blah2"/>
<label for="blah">CLICK ME</label>

link for reference

That is all great and stuff, however JSF renders the labels a little differently, like so:

<label><input type="radio" id="blah" name="blah2"/>CLICK ME</label>

Well, that's not so bad, except for one thing.


So, since the default JSF rendering doesn't work, I thought about trying to implement the first one manually by using some f:verbatim tags to put the extra tag in there. Only problem is that there is no ID on the f:selectItem, so there is no way to attach a label to it for IE

Second, I had thought about using the tomahawk component library, because they have this neet little feature called forceId, which allows me to put an id on a component. 2 problems here, first, tomahawk doesn't have a selectItem component, only selectItems. Secondly, selectItems doesn't accept the forceId attribute, which makes sence because it is used to display a list of items.

my LAST resort, would be to create a custom component that can plug in with tomahawk to be able to use the forceId attribute, and then put the label tag in manually.

Can anybody offer any help or insight with this? 99% of our users are using IE, and this is a requirement.


It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!