You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Julian Osorio Amaya <ju...@linuxmail.org> on 2010/10/29 17:07:41 UTC

Check/Uncheck items from selectManyCheckbox

 Greetings

I'm trying to check/uncheck the selectManyCheckBox items that depends on the user selection. For example
damage No 1
damage No 2
damage No 3
no damage

if the user checks the "no damage" option, all other checkboxes should be unchecked
if the user checks a different option from "no damage",  the "no damage" option should be unchecked

here is the code in the jsp page

<h:selectManyCheckbox id="danos" value="#{MANT15.damage}" 
                        layout="pageDirection" required="true" valueChangeListener="#{MANT15.procesarDanoSeleccionado}"
                        onchange="submit()">
                    <f:selectItems value="#{MANT15.damages}"/>
 </h:selectManyCheckbox>

Here is the code in the backing bean

public void procesarDanoSeleccionado(ValueChangeEvent event) {
        HtmlSelectManyCheckbox listaCheckDanos = (HtmlSelectManyCheckbox) event.getComponent().findComponent("danos");
        lista = new ArrayList();
        lista = (ArrayList) listaCheckDanos.getValue();        
}

the attribute "lista" has the selected values but I don't know how to access to the checkboxes of each item


Any idea?

Thanks for your time

Julian Osorio Amaya
=