0

My Code for displaying checkboxes is this

<div class="col-md-6" style="box-sizing: initial;width:100%">
                                        The inclusions for this purpose are (choose as many as apply)
                                        <h:selectManyCheckbox
                                                value="#{dataCollectionBackingBean.testing.inclusions}"
                                                layout="pageDirection">
                                                <f:selectItems
                                                    value="#{dataCollectionBackingBean.availableInclusions.entrySet()}" var="inclusion"
                                                    itemValue="#{inclusion.key}" itemLabel="#{inclusion.value}"/>

                                            </h:selectManyCheckbox>
                                    </div>

Here availableInclusions is a LinkedHashMap. I want to disable only the first Checkbox when a certain option is selected in a dropdown. I am using JSF 2.0

Tiny
  • 27,221
  • 105
  • 339
  • 599
Adityaz7
  • 61
  • 1
  • 6
  • Add a method in the backing bean, which returns the select items and sets them as available/unavailable depending on the dropdown selection. Assume, the new method is called `getModifiedAvailableInclusions()`, you then only need to change the ` – Dominik Sandjaja Aug 24 '16 at 06:46
  • well how jsf would know that "unavailable" flag means the corresponding option is to be disabled? – Adityaz7 Aug 24 '16 at 07:30
  • 1
    You can set a flag in your returned items or you can put an EL expression in the `itemDisabled={...}` attribute. – Dominik Sandjaja Aug 24 '16 at 09:25

0 Answers0