3 Replies Latest reply on Nov 8, 2012 10:22 AM by codigoadf

    Enable Button on selectOneChoice value change

      Hi Friends,

      I am using JDeveloper

      I dragged and dropped one selectOneChoice from the data control and one button from the component palette.

      Now, I just want to enable the button on the selectOneChoice value change. If the value is not changed then the button will be disabled.

      Please help me.


        • 1. Re: Enable Button on selectOneChoice value change
          Sudipto Desmukh
          Make the visible property of the button to false in the property inspector.
          Bind the button to a managed Bean.

          In the valueChangeListener of the SOC write the following code
          public void VCListener(ValueChangeEvent vcEvent){
          • 2. Re: Enable Button on selectOneChoice value change
            1. bind button to the backing bean property, for example:
               // in the backing bean (YourBean.java)
               private RichCommandToolbarButton myBtn;
                public void setMyBtn(RichCommandToolbarButton ctb2) {
                    this.myBtn = ctb2;
                public RichCommandToolbarButton getMyBtn() {
                    return myBtn;
              // in the .jspx:
                                                       binding="#{yourBean.myBtn}" />
            2. make (and set) selectOneChoice valueChangeListener (YourBean.java):
                 public void mySoc_VCL(ValueChangeEvent e){
            Edited by: Cvele_new_account on Nov 8, 2012 2:21 AM
            1 person found this helpful
            • 3. Re: Enable Button on selectOneChoice value change
              in your button put disabled a true.
              then make a valuechangeListener in your selectoneChoice with autosubmit true.
              <af:commandButton text="commandButton 2" id="cb2" disabled="true" binding="#{MyBean.myButton}"/>
                            <af:selectOneChoice label="Label 1" id="soc1" binding="#{MyBean.button}" valueChangeListener="#{MyBean.change}" autoSubmit="true">
                              <af:selectItem label="a" value="a" id="si2"/>
                              <af:selectItem label="b" value="b" id="si3"/>
                              <af:selectItem label="c" value="c" id="si1"/>
                  public void change(ValueChangeEvent valueChangeEvent) {
                      //getMyButton is component binding(RichCommandButton)
                     //refresh component