• Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying an outputLabel below a radio button  RSS feed

 
Daniel Conner
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This problem seemed to me to be a lot easier than it winded up being. I hope someone can help shed some light on it. Here it goes... I need to dynamically display a list of radio buttons(it gets the data from a database). Here is the catch. Underneath each radio button, there needs to be an additional line of text describing the radio button. I don't need help with accessing the database, getting the data from my backing bean, or even displaying the radio buttons to the screen. I have that covered. What I need help with is displaying the line of descriptive text that goes below each radio button. Here is what I have tried in my jsp:

<af:selectOneRadio >
<af:forEach var="sg" items="#{sgMainBean.sgList}">
<af:selectItem label="#{sg.sname}" />
</af:forEach>
</af:selectOneRadio>

The problem with going that route is that I have no place to put the line that prints out the description:
<afutputLabel value="#{sg.description}"/>

If I put it inside the forEach tag, then it is inside the selectOneRadio and will not be displayed correctly. Also, if I put it outside the selectOneRadio tag, then it is outside the forEach tag and is not iterated with the rest of the bunch.

Another route I have tried is the following:

<af:selectOneRadio>
<f:selectItems value="#{sgMainBean.showSelectItems"/>
</af:selectOneRadio>

Again, since it just goes through all the items, I am unclear on where I can put the code to access the description where it can be reached. Any help would be great. Thanks.
 
Daniel Conner
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any help would be greatly appreciated.....
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What JSF implementation are the AF tags with? That might help. Also, I'd venture to guess that you're not likely to find an answer. It doesn't sound typical to me to place description text beneath a radio button with a label. And I doubt the library accounted for anything outside the norm. It seems more likely there might be a tooltip available with the description text when you hover over the radio button. Might the af implementation have a tooltip tag you can place inside the selectItem tag or something?

Of course, you have to love how anytime you need to step out of the box with a JSF application, you are stuck writing your own components to handle the situation rather than just writing some simple HTML.
 
Daniel Conner
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The af tags are using the ADF implementation... Also, there is shortDesc that I could place inside the tag for a tooltip. I wish that solved my problem though. Assuming the stars are the radio buttons. This is what I need.

* radio button 1
Description of radio button 1

* radio button 2
Description of radio button 2

So, you think I need to write a custom component to solve this?

Thank you for your reply.

[ April 12, 2007: Message edited by: Daniel Conner ]
[ April 12, 2007: Message edited by: Daniel Conner ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Daniel Conner:


So, you think I need to write a custom component to solve this?



Well, if the component set you have doesn't provide the functionality you require, I don't see any other way. It may be something as simple (relatively speaking of course) as changing the renderer of the current component. But I have no experience with that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!