JSF: SelectOneRadio shortcuts for options

Posted by pakore on Stack Overflow See other posts from Stack Overflow or by pakore
Published on 2010-03-17T10:51:27Z Indexed on 2010/03/17 12:31 UTC
Read the original article Hit count: 589

I have the following h:selectOneRadio:

<h:selectOneRadio style="text-align:left" layout="pageDirection" id="#{prefix}_rating" value="#{examinationPanel.tempResult}" >
<f:selectItems value="#{examinationPanel.options}"></f:selectItems>
</h:selectOneRadio>

And then the backing bean is loading the options based on some userpreferences:

public List<SelectItem> loadOptions (Set<ResultEnum> possibleResults){
    messages =ResourceBundle.getBundle("com.eyeprevent.resources.Messages",FacesContext.getCurrentInstance().getViewRoot().getLocale());
    List<SelectItem> options = new ArrayList<SelectItem>();
    for(ResultEnum result:possibleResults){
        SelectItem option = new SelectItem(result,messages.getString(result.name()));
        options.add(option);
    }
    return options;
}

How can I define shortcuts for the options in the radio group? por example typing "1" selects the first option, typing "2" the second, etc...

Thanks in advance! ps. I'm using Jsf 1.2, Richfaces, Primefaces and Facelets.

© Stack Overflow or respective owner

Related posts about jsf

Related posts about richfaces