0

I'd like to disable/enable SelectManyCheckbox and the SelectOneMenu based on my selection. I have two radio buttons to be selected whether A or B. The SelectManyCheckbox and the SelectOneMenu should be disabled at the first run. When the user selects “A” the SelectManyCheckbox and the SelectOneMenu should be enabled and if the users selects “B”, the SelectManyCheckbox and the SelectOneMenu should be disabled and the items should be empty. I tried to use <f:ajax render="certificates"/>, but it doesn't work properly.

<h:selectOneRadio id="request" layout="pageDirection" value="#{user.hrRequest}" required="true" requiredMessage="Error: Select a Request Type">  
      <f:selectItem itemLabel=" Request A" itemValue="A"/>

             <f:selectItem itemLabel="Request B”  itemValue="B"/>

               <f:ajax render="certificates"/>

</h:selectOneRadio>

<h:selectManyCheckbox value="#{user.hrCertificate2}" id="hrcertificates" disabled="#{user. hrRequest  == ‘B’}"  label="Forward Request to HR" layout="pageDirection" required="true" requiredMessage="Error: Select t least One ">

 <f:selectItems value="#{user.hrCertificate2Value}" />

  </h:selectManyCheckbox>


 <h:selectOneMenu label="c_e_language_hr" disabled="#{user. hrRequest  == 'B'}">

   <f:selectItem itemLabel="Please Select a Language" itemValue="#{user.CertificateLanguage}"/>
    <f:selectItem itemLabel="French" itemValue="fr"/>
    <f:selectItem itemLabel="English" itemValue="en"/>
                </h:selectOneMenu>

So how to do this using ajax

3
Contributors
2
Replies
13
Views
2 Years
Discussion Span
Last Post by diafol
0

I think this is JSF? Should this go to the Java forum?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.