tags:

views:

1335

answers:

1

Hello,

I am actually using h:selectOneMenu to display items, given to it from f:selectItems tag.

Rather than displaying a text, I wanna prefer to display an image.

How is it possible, since there I have not found any way to render html coming from the selectItem "value" attribute ?

Thanks, here is my current code, without any image display ...

<h:selectOneRadio layout="spread" value="#{question.candidateAnswer.value}"  
    disabledClass="invalid_choice" enabledClass="valid_choice" >

    <a:support event="onchange" actionListener="#{answerManager.answer}" 
        reRender="zoneQuestions, zoneNavigation, zoneScenariiList, zoneCart" />

    <f:selectItems value="#{question.choices}" />

</h:selectOneRadio>

Thanks

A: 

All h:selectOneMenu does is to render an HTML select input. This can't display images.

You will need a custom component. You could probably style the Richfaces dropdown menu to work like a select input, however you're probably better off looking at these jQuery plugins to enhance your combo boxes

Damo
Okey, good to know that there absolutely no way to display images with the original h:selectOneMenu.So as you said, a custom component what a solution.What I've done is extending the RadioRenderer class, overriding the renderOption(..) method, and ask for another xml element (img) into the option representation, and used the SelectItem.getDescription() to contain the image url.Bit tricky, but works for now.
ipingu