This discussion is archived
10 Replies Latest reply: Oct 7, 2013 4:46 AM by Manidhar RSS

valuechangeListener for selectBooleanCheckbox is not working inside switcher component

Manidhar Newbie
Currently Being Moderated

Hi,

 

If I am using the below selectBooleanCheckbox outside the switcher component the valuechangelistner is getting invoked. But when i use the same thing inside the switcher component the valueChangeListener is not getting invoked.

 

The sample code i used is as below:

 

  <af:selectBooleanCheckbox label="Keee"  id="test11111" autoSubmit="true" immediate="true"   valueChangeListener="#{pageFlowScope.ServicesBean.performBasedOnSelectedCallType}" />



Any immediate help is appreciated.


Thanks,


Manidhar

  • 1. Re: valuechangeListener for selectBooleanCheckbox is not working inside switcher component
    Timo Hahn Oracle ACE
    Currently Being Moderated

    Manidhar, please tell us your jdev version!


    I don't see a switcher. Can you post the code for this too, please?


    Timo

  • 2. Re: valuechangeListener for selectBooleanCheckbox is not working inside switcher component
    dvohra21 Oracle ACE
    Currently Being Moderated

    Is a f:facet used?

     

    <af:switcher id="sw" facetname="facetname" defaultFacet="Other">

                   

                    <f:facet name="CallType">

                       <af:selectBooleanCheckbox label="Keee"  id="test11111" autoSubmit="true" immediate="true"   valueChangeListener="#{pageFlowScope.ServicesBean.performBasedOnSelectedCallType}" />               

                    </f:facet>

                    

                  </af:switcher>

  • 3. Re: valuechangeListener for selectBooleanCheckbox is not working inside switcher component
    Manidhar Newbie
    Currently Being Moderated

    Hi All,

     

    I am using the jdev 11.1.1.6.0. The sample code snippet is as below:

     

    <af:panelGroupLayout id="pgl16"

                             binding="#{pageFlowScope.ServicesBean.panelDisplaySwitcher}"

                             partialTriggers="soc2">

     

          <af:switcher id="s19" facetName="#{bindings.RateType.inputValue}"

                       binding="#{pageFlowScope.ServicesBean.rateplanSwitcher}">

            <f:facet name="1">

              <af:group id="g5">

            <af:selectBooleanCheckbox label="Home"  id="t1" autoSubmit="true" immediate="true"

                                       selected="true"

                                       valueChangeListener="#{pageFlowScope.ServicesBean.performBasedOnSelectedCallType}"/>

    </af:group>

    </f:facet>

    </af:switcher>

    </af:panelGroupLayout>

     

     

    Thanks

    Manidhar

  • 4. Re: valuechangeListener for selectBooleanCheckbox is not working inside switcher component
    Timo Hahn Oracle ACE
    Currently Being Moderated

    This code works for me:

            <af:panelStretchLayout topHeight="50px" id="psl1">

              <f:facet name="top">

                <af:outputText value="Switcher Test" id="ot1" inlineStyle="font-size:x-large;"/>

              </f:facet>

              <f:facet name="center">

                <!-- id="af_one_column_header_stretched"  -->

                <af:panelGroupLayout id="pgl16" binding="#{pageFlowScope.SwitcherBean.panelDisplaySwitcher}" partialTriggers="soc1">

                  <af:switcher id="s19" facetName="#{bindings.RateType1.inputValue}" defaultFacet="default">

                    <f:facet name="1">

                      <af:group id="g5">

                        <af:selectBooleanCheckbox label="Home" id="t1" autoSubmit="true" immediate="true" selected="true"

                                                  valueChangeListener="#{pageFlowScope.SwitcherBean.performBasedOnSelectedCallType}"/>

                      </af:group>

                    </f:facet>

                    <f:facet name="default">

                      <af:outputText value="outputText1" id="ot2"/>

                    </f:facet>

                  </af:switcher>

                </af:panelGroupLayout>

              </f:facet>

              <f:facet name="bottom">

                <af:selectOneChoice label="Selection" value="#{bindings.RateType1.inputValue}" id="soc1" autoSubmit="true">

                  <af:selectItem label="Do 1" value="1" id="si2"/>

                  <af:selectItem label="Do 2" value="2" id="si3"/>

                  <af:selectItem label="Do 3" value="3" id="si1"/>

                </af:selectOneChoice>

              </f:facet>

            </af:panelStretchLayout>

    and the valuechange listener for the af:selectBooleanCheckbox

        public void performBasedOnSelectedCallType(ValueChangeEvent valueChangeEvent) {

           System.out.println("IN VALUE CHANGED");

        }

     

    Check the coding for your switcher as you did not specify a default facet!

     

    Timo

  • 5. Re: valuechangeListener for selectBooleanCheckbox is not working inside switcher component
    Manidhar Newbie
    Currently Being Moderated

    Hi Timo,

     

    Still my code is not working. This is the exact code which i am using. Please let me know where i went wrong.

     

    The switcher component is displayed based on the dropdown selection. So i have not set the defaultfacet. I have tried to set the defaultfacet still its not working.

    <af:panelGroupLayout id="pgl16"

                             binding="#{pageFlowScope.ServicesBean.panelDisplaySwitcher}"

                             partialTriggers="soc2">

     

          <af:switcher id="s19" facetName="#{bindings.RateType.inputValue}"

                       binding="#{pageFlowScope.ServicesBean.rateplanSwitcher}" defaultFacet="1">

            <f:facet name="1">

              <af:group id="g5">

         

    <af:forEach items="#{pageFlowScope.ServicesBean.allCallTypesFromEO}" var="row">

      <af:panelGroupLayout id="pgl26" layout="horizontal">

    <af:selectBooleanCheckbox value="#{row.value}" immediate="true" autoSubmit="true" valueChangeListener="#{pageFlowScope.ServicesBean.performBasedOnSelectedCallType}" partialTriggers="soc2">

    </af:selectBooleanCheckbox>

    <af:outputText value="#{row.label}"/>

    </af:panelGroupLayout>

                <af:panelGroupLayout id="pgl9" layout="horizontal">

                  <af:panelBox text="Inbound" id="pb1" showDisclosure="false"

                               visible="#{bindings.Direction.inputValue eq 'I' or bindings.Direction.inputValue eq 'B' and bindings.ServiceRateplanInboundVO4.estimatedRowCount >0}">

                    <af:panelGroupLayout id="flat_inbound" layout="horizontal">

                      <af:panelGroupLayout id="pgl19" layout="horizontal">

                        <af:spacer width="10" height="30" id="s37"/>

                        <af:iterator value="#{bindings.ServiceRateplanInboundVO4.collectionModel}"

                                     varStatus="vs" var="rowInbound" rows="-1"

                                     id="i13">

                          <af:outputFormatted value="Amount" id="of9"/>

                          <af:inputText value="#{rowInbound.LevelRate}" id="it1"

                                        autoSubmit="true" columns="10"

                                        immediate="true">

                            <af:clientListener method="decimalNumberValidation"

                                               type="keyUp"/>

                            <af:clientListener method="decimalPointValidation"

                                               type="blur"/>

                          </af:inputText>

                          <af:outputFormatted id="of6"

                                              binding="#{pageFlowScope.ServicesBean.flatInboundLabel}"

                                              value="#{viewcontrollerBundle.PERMINUTE}"/>

                        </af:iterator>

                      </af:panelGroupLayout>

                      <af:spacer width="10" height="10" id="s20"/>

                    </af:panelGroupLayout>

                  </af:panelBox>

                  <af:spacer width="30" height="10" id="s27"/>

                  <af:panelBox text="Outbound" id="pb2" showDisclosure="false"

                               visible="#{bindings.Direction.inputValue eq 'O' or bindings.Direction.inputValue eq 'B'  and bindings.ServiceRateplanOutboundVO4.estimatedRowCount >0 }">

                    <af:panelGroupLayout id="flat_outbound" layout="horizontal">

                      <af:spacer width="10" height="30" id="s38"/>

                      <af:iterator value="#{bindings.ServiceRateplanOutboundVO4.collectionModel}"

                                   varStatus="vs" var="rowOutbound" rows="-1"

                                   id="i9">

                        <af:outputFormatted value="Amount" id="of1"/>

                        <af:inputText value="#{rowOutbound.LevelRate}"

                                      autoSubmit="true" id="it3" columns="10"

                                      immediate="true">

                          <af:clientListener method="decimalNumberValidation"

                                             type="keyUp"/>

                          <af:clientListener method="decimalPointValidation"

                                             type="blur"/>

                        </af:inputText>

                        <af:outputFormatted value="#{viewcontrollerBundle.PERMINUTE}"

                                            id="of10"

                                            binding="#{pageFlowScope.ServicesBean.flatOutboundLabel}"/>

                      </af:iterator>

                    </af:panelGroupLayout>

                  </af:panelBox>

                </af:panelGroupLayout>

    </af:forEach>

              </af:group>

            </f:facet>

    </af:switcher>

    </af:panelGroupLayout>

     

    Thanks

    Manidhar

  • 6. Re: valuechangeListener for selectBooleanCheckbox is not working inside switcher component
    Timo Hahn Oracle ACE
    Currently Being Moderated

    Have you tried my code? does this work for you?

     

    As you only use one facet in the switcher you don't need it at all. What is the real purpose for the switcher?

    You code is hard to digest. How about making a simple test case which either work or you see the behavior you are telling us about. If the sample works put your real work back in.

     

    Timo

  • 7. Re: valuechangeListener for selectBooleanCheckbox is not working inside switcher component
    Manidhar Newbie
    Currently Being Moderated

    I have not tried your code. There are 6 facets inside my switcher. As the code is around 500 lines i did not past the code completely. I have a drop down and based on the selected value of the drop down i need to display the facets inside the switcher. I will try your code and let you know.

     

    Thanks

    Manidhar

  • 8. Re: valuechangeListener for selectBooleanCheckbox is not working inside switcher component
    Frank Nimphius Employee ACE
    Currently Being Moderated

    Manidhar,

     

    what is the purpose of you asking if you don't try the code that someone provides you? Run Timo's code and if it works for you , compare your code with Timo's to understand the differences. It doesn't get you anywhere if you are not working with the people providing you help. One of the differences I see is that you use the "binding" property on components and point it to a managed bean in page flow scope. Component bindings in JSF should not be in any scope longer than backing bean scope or request scope because i) you in the component state and ii) components are not serializable. Please change this as this already may cause the problems you see.

     

    Frank

  • 9. Re: valuechangeListener for selectBooleanCheckbox is not working inside switcher component
    Manidhar Newbie
    Currently Being Moderated

    Hi Frank,

     

    Timo's example is running proper as an standalone example when i tried to integrate it in my app this is not working. I will implement your suggestionsand let you know.

     

    Thanks,

    Manidhar

  • 10. Re: valuechangeListener for selectBooleanCheckbox is not working inside switcher component
    Manidhar Newbie
    Currently Being Moderated

    Hi All,

     

    Just by removing the javascript method calls in my code i was able to be make it work

     

     

    Because of below code it was not working.

     

    <af:inputText value="#{rowOutbound.LevelRate}"

                                      autoSubmit="true" id="it3" columns="10"

                                      immediate="true">

                          <af:clientListener method="decimalNumberValidation"

                                             type="keyUp"/>

                          <af:clientListener method="decimalPointValidation"

                                             type="blur"/>

                        </af:inputText>

     

    After doing the necessary changes to the code i was able to call the valuechangelistener.

     

    Thanks,

     

    Manidhar

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points