H:selectBooleanCheckbox valuechangelistener help

Hi all,
I have a page with a dataTable that holds information about sales items. On the first visit to the page, the table is displayed normally and sorted by price. It takes a Result as its collection so any sorting is done in SQL. I want to support grouping the items by quantity as well so I used the t:dataTable component and specified a groupBy column. Outside of the table, I have an h:selectBooleanCheckbox that has a value of myBean.groupByQuantity, a valueChangeListener, and an onchange="this.form.submit()". The groupByQuantity boolean is also used in the t:column as the groupBy value. The value change listener checks the value of the groupByQuantity boolean and runs an appropriate query (to order by price or quantity).
Some relevant code:
<t:dataTable value="#{myBean.items}" var="item" groupByStyle="groups">
   <t:column>
    <t:column groupBy="#{myBean.groupByQuantity}">
       <h:outputText value="#{item.quantity}"/>
    </t:column>
</t:dataTable>
<h:selectBooleanCheckbox value="#{myBean.groupByQuantity}"
valueChangeListener="#{myBean.processValueChangeEvent}"
onclick="this.form.submit()"/>In the MyBean.java
public class MyBean{
private boolean groupByQuantity = false;
//getters and setters for groupByQuantity
public void processValueChangeEvent(ValueChangeEvent vce){
   if (!groupByQuantity){
     //run SQL to order by quantity
   }else{
     //run SQL to order by price
public String goBackToList(){
   //run SQL to order by price
   groupByQuantity = false;
}When using the checkbox to toggle the value of groupByQuantity, the code acts as expected (except for the fact that it seems as if the checkbox is submitting the opposite value as it should which is why the two have to be reversed). However, if a user leaves the page and comes back using the goBackToList method, the checkbox keeps whatever state it was in when the application navigated away from the page even though I explicitly set the value to false and secondly, if the value was true then the application runs the query to order by price but the group by style is being displayed but if it is false, the query to run the order by quantity is run and the group by style is not displayed.
Having this information, I can see two problems but do not understand why they are happening. The first is that when I navigate to the page, the valueChangeListener event is being called even though I have not touched the checkbox. This must be happening because that method is the only place where there is a query to order by quantity. The other problem is that the value that is getting submitted to the backing bean and the value that is being reflected by the checkbox and groupBy attributes are not the same value. Has anyone had a similar problem? Does anyone have any advice on how to fix this?
Thanks in advance,
JR

Hi all,
I have a page with a dataTable that holds information about sales items. On the first visit to the page, the table is displayed normally and sorted by price. It takes a Result as its collection so any sorting is done in SQL. I want to support grouping the items by quantity as well so I used the t:dataTable component and specified a groupBy column. Outside of the table, I have an h:selectBooleanCheckbox that has a value of myBean.groupByQuantity, a valueChangeListener, and an onchange="this.form.submit()". The groupByQuantity boolean is also used in the t:column as the groupBy value. The value change listener checks the value of the groupByQuantity boolean and runs an appropriate query (to order by price or quantity).
Some relevant code:
<t:dataTable value="#{myBean.items}" var="item" groupByStyle="groups">
   <t:column>
    <t:column groupBy="#{myBean.groupByQuantity}">
       <h:outputText value="#{item.quantity}"/>
    </t:column>
</t:dataTable>
<h:selectBooleanCheckbox value="#{myBean.groupByQuantity}"
valueChangeListener="#{myBean.processValueChangeEvent}"
onclick="this.form.submit()"/>In the MyBean.java
public class MyBean{
private boolean groupByQuantity = false;
//getters and setters for groupByQuantity
public void processValueChangeEvent(ValueChangeEvent vce){
   if (!groupByQuantity){
     //run SQL to order by quantity
   }else{
     //run SQL to order by price
public String goBackToList(){
   //run SQL to order by price
   groupByQuantity = false;
}When using the checkbox to toggle the value of groupByQuantity, the code acts as expected (except for the fact that it seems as if the checkbox is submitting the opposite value as it should which is why the two have to be reversed). However, if a user leaves the page and comes back using the goBackToList method, the checkbox keeps whatever state it was in when the application navigated away from the page even though I explicitly set the value to false and secondly, if the value was true then the application runs the query to order by price but the group by style is being displayed but if it is false, the query to run the order by quantity is run and the group by style is not displayed.
Having this information, I can see two problems but do not understand why they are happening. The first is that when I navigate to the page, the valueChangeListener event is being called even though I have not touched the checkbox. This must be happening because that method is the only place where there is a query to order by quantity. The other problem is that the value that is getting submitted to the backing bean and the value that is being reflected by the checkbox and groupBy attributes are not the same value. Has anyone had a similar problem? Does anyone have any advice on how to fix this?
Thanks in advance,
JR

Similar Messages

  • Urgent Help on valueChangeListener

    Hi Everybody
    My seconfd post for the same probs. I am trying to invoke a method of a backing bean using valueChangeListener in a selectOneListbox. The problem is this method is not getting invoked. I tried every thing but still lack an answer. I am posting the whole code this time.
    song.jsp
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <html>
       <head>
          <title>Song Detail</title>
       </head>
       <body>
          <f:view>   
               <h:form id="songForm">
                       <H4>Select a song to view detail.</H4>
                </Br>
                       <h:selectOneListbox id="songList" value="#{backingBean.selectedSong}" valueChangeListener="#{backingBean.processValueChange}" immediate="true" onchange="this.form.submit()">
                              <f:selectItems value="#{backingBean.songList}"/>
                     </h:selectOneListbox>
                <p>
                 <h:outputText id="result" value="#{backingBean.songDetail}"/>
             </p>   
         </h:form>                  
       </f:view>
      </body>
    </html>SongBean.java
    package song;
    import java.util.ArrayList;
    import javax.faces.model.SelectItem;
    import javax.faces.event.ValueChangeEvent;
    import javax.faces.event.AbortProcessingException; 
    public class SongBean
      ArrayList songList = new ArrayList();
      SelectItem selectedSong;
      String songDetail;
       public SongBean()
         System.out.println("Inside constructor");
        songList.add(new SelectItem("mm","Midnight melodies","m"));
        songList.add(new SelectItem("rc","Rock cradle","r"));
        songList.add(new SelectItem("pc","Purple clouds","p"));
    public SelectItem getSelectedSong () {
         return new SelectItem("mm","Midnight melodies","m");
      public void setSelectedSong (SelectItem selectedSong) {
         this.selectedSong=selectedSong;
      public ArrayList getSongList() {
          return songList;
    public void setSongList(ArrayList songList) {
          this.songList=songList;
      public String getSongDetail() {
          return songDetail;
    public void setSongDetail(String songDetail) {
          this.songDetail=songDetail;
    public void processValueChange(ValueChangeEvent vce) throws AbortProcessingException
              System.out.println("Method invoked");
              String userSong=(String)selectedSong.getValue();
              System.out.println(userSong);        
    }face-config.xml
    <?xml version="1.0"?>
    <!DOCTYPE faces-config PUBLIC
      "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
      "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config> 
      <managed-bean>
        <managed-bean-name>backingBean</managed-bean-name>
        <managed-bean-class>song.SongBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
    </faces-config>Plz HELP.

    Back bean property CAN'T be a SelectItem.
    Try this toy code:
    /* song.jsp */
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <html>
    <head>
      <title>Song Detail</title>
    </head>
    <body>
      <f:view>
        <h:form id="songForm">
          <H4>Select a song to view detail.</H4>
          </br>
          <h:selectOneListbox id="songList"
                              value="#{backingBean.selectedSong}"
                        valueChangeListener="#{backingBean.processValueChange}"
                        immediate="true"
                        onchange="this.form.submit();">
            <f:selectItems value="#{backingBean.songList}"/>
          </h:selectOneListbox>
          </br></br>
          <h:outputText id="result" value="#{backingBean.songDetail}" />
        </h:form>
      </f:view>
    </body>
    </html>
    /* SongBean.java */
    package song;
    import javax.faces.context.FacesContext;
    import java.util.ArrayList;
    import javax.faces.model.SelectItem;
    import javax.faces.event.ValueChangeEvent;
    import javax.faces.event.AbortProcessingException;
    public class SongBean{
      ArrayList<SelectItem> songList = new ArrayList<SelectItem>();
      String selectedSong;
      String songDetail = "<Here comes the song detail>";
      public SongBean(){
        songList.add(new SelectItem("mm000", "Midnight Melodies", "m"));
        songList.add(new SelectItem("rc000", "Rock Cradle", "r"));
        songList.add(new SelectItem("pc000", "Purple Clouds", "p"));
        songList.add(new SelectItem("pc001", "Red Rains", "p"));
        songList.add(new SelectItem("rc001", "Back Basher", "r"));
        songList.add(new SelectItem("mm001", "Morning Yawns", "m"));
      public String getSelectedSong () {
        return selectedSong;
      public void setSelectedSong (String selectedSong) {
        this.selectedSong = selectedSong;
      public ArrayList<SelectItem> getSongList() {
        return songList;
      public void setSongList(ArrayList<SelectItem> songList) {
        this.songList = songList;
      public String getSongDetail() {
        return songDetail;
      public void setSongDetail(String songDetail) {
        this.songDetail = songDetail;
      public void processValueChange(ValueChangeEvent vce){
        setSongDetail("This is your favorite song.");
        FacesContext.getCurrentInstance().renderResponse();
    [faces-config.xml entry]
    <managed-bean>
      <managed-bean-name>backingBean</managed-bean-name>
      <managed-bean-class>song.SongBean</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>

  • Help with Custom Component: Ajax and ValueChangeListener

    Hello,
    I am trying to create a custom component that triggers an update via Ajax. However, I would also like to trigger a ValueChangeListener method from the same component, however I am unsure of how to obtain and trigger the ValueChangeEvent.
    The code I have so far in the Phase Listener is:
    private void handleAjaxRequest(PhaseEvent event) {
         FacesContext context = event.getFacesContext();
            HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
            Object object = context.getExternalContext().getRequest();
            if (!(object instanceof HttpServletRequest)) {
                return;
            HttpServletRequest request = (HttpServletRequest)object;
            HttpSession session =  request.getSession();
            String requestType = request.getParameter("jsflotRequestType");
            if (requestType != null && requestType.equalsIgnoreCase("jsflotchartValueChange")) {
                 //Trigger valueChangeEvents
                 log.info("Handling JSFlot Chart Value Change Event.");
    }What I am looking for though, is some information regarding how to obtain the ValueChangeListener from the request/session objects.
    The component tag is called like this:
    <jsflot:flotChart id="valueTimeChart"
         value="#{chartMbean.chartSeries}"
         valueChangeListener="#{chartMbean.valueChangeListener}"Any help would be greatly appreciated!

    The field calculation order was not in the correct order, had a devil of a time figuring out how to get to it, in Acrobat X.
    My check boxes for shipping have the same name field but I don't see a tab for export value for the check boxes, and I have no idea how to implement your suggestions for a switch or if statement or what fields to attach them to. 
    My amatuer attempt at a shipping formula follows, I don't know if I can use a range for event value, or where to put the script, if it is even correct.
    if(event.value == "<25.01")
        nShipFee = 06;
    else if(event.value == "25.01 - 75")
        nShipFee = 11.50;
    else if(event.value == "75.01 - 125")
        nShipFee = 15;
    else if(event.value == "125.01 - 200")
        nShipFee = 20;
    else if(event.value == "200.01 - 300")
        nShipFee = 25;
    else if(event.value == "300.01 - 400")
        nShipFee = 30;
    else if(event.value == ">400")
        nShipFee = 50;

  • SelectBooleanCheckbox help needed

    Hi all,
    I have to use Checkbox for each row of datatable with some unique value. I am able to generate the checkboxes based on the datatable, but could assing value based for each rows. Please provide any help in usage of check boxes for such case. Thanks in advance.
    Mruthyunjaya

    My code in JSp page
    <h:dataTable value="#{manageBean.users}" var="usersData" border="0" cellspacing="0" cellpadding="0" headerClass="HEADING" rowClasses="evenrow,oddrow" width="450">
    <h:column>
    <f:facet name="header"/>
    <h:selectBooleanCheckbox id ="user" value="1"/>
    <h:outputText id="firstName" value="#{usersData.firstName}"/>
    </h:column>
    </h:dataTable>
    With the above code i am able to generate the check boxes for the number of rows, but using java script i want to knwo which check box is selected. please need some info about it.
    thanks and regards
    Mruthyunjaya

  • Help needed with valueChangeListener problem

    I have the following code:
    <h:dataTable border="0" id="constituyentes" value="#{db_inserta.constituyentes}" var="vl" style="text-align: center;" bgcolor="#F5F5F5" cellpadding="8">
         <h:column>
              <f:facet name="header">
                   <h:outputText value="Constituyente" style="color:#800027;font-weight: bold;"/>
              </f:facet>
                <h:outputText value="#{vl.Descripcion}" style="color:#0000FF;"/>
         </h:column>
         <h:column>
              <f:facet name="header">
                   <h:outputText value="Resultado" style="color:#800027;font-weight: bold;"/>
              </f:facet>          
              <h:inputText value="#{db_almacena.valores}" style="color:#0000FF;" valueChangeListener="#{db_almacena.almacenoVector}" immediate="true"/>
              <f:param name="orden" value="#{vl.Orden}"/>
         </h:column>
    </h:dataTable>
    the db_almacena bean:
            ArrayList vect_valores=new ArrayList();
         public void almacenoVector(ValueChangeEvent event)
                 System.out.println("Going to change the System");
                 vect_valores.add(new SelectItem(new String(g)));
           public String getValores(){
              return valores;
         public void setValores(String set) {
              valores = set;
         }The dataTable is filled from a Resultset. It gives 5 sets (rows).
    My idea is to get the values from the inputText of each row and store it in an ArrayList. That is why I use the valueChangeListener.
    I have 2 problems:
    1. The values of the inputText are not got by the db_almacena (session scope).
    2. If I have in the valueChangeListener method of the bean the line: "vect_valores.add(new SelectItem(new String(g)));"
    I get an error caused by the ProcessValidationPhase.
    Any ideas?
    Thanks in advance

    Right now I am at the following point:
    <h:dataTable border="0" id="constituyentes" value="#{db_inserta.constituyentes}" var="vl" style="text-align: center;" bgcolor="#F5F5F5" cellpadding="8">
       <h:column>
         <f:facet name="header">
              <h:outputText value="Constituyente" style="color:#800027;font-weight: bold;"/>
         </f:facet>
           <h:outputText value="#{vl.Descripcion}" style="color:#0000FF;"/>
       </h:column>
       <h:column>
         <f:facet name="header">
              <h:outputText value="Resultado" style="color:#800027;font-weight: bold;"/>
         </f:facet>          
         <h:inputText value="#{db_almacena.valores}" style="color:#0000FF;" valueChangeListener="#{db_almacena.almacenoVector}"/>
         <f:param name="orden" value="#{vl.Orden}"/>
       </h:column>
       <h:column>
         <f:facet name="header">
              <h:outputText value="Unidades" style="color:#800027;font-weight: bold;"/>
         </f:facet>
         <h:outputText value="#{vl.Unidades}" style="color:#405172;"/>
       </h:column>
    </h:dataTable>
    <br />     
    <br />         
    <h:commandButton action="adelante" value="SIGUIENTE -->" />
    My db_almacena bean:
         public String getValores(){
              System.out.println("El valor es: "+valores);
              return valores;
         public void setValores(String set) {
              valores = set;
         public void almacenoVector(ValueChangeEvent event)
                 System.out.println("Going to change the System");
                 String valor = (String) event.getNewValue();
                 vect_valores.add(new SelectItem(new String(valor)));
         }The getter getValores does not get any value, it always shows: "El valor es: null"
    Moreover, if I am not misunderstanding (I am sure I am) the getNewValue method returns the current UIComponent value. So, do I have to make a binding?
    I start thinking that my approach is not correct. Is there any other way of getting the inputText values of a dataTable that comes from a resultset??
    Thanks again

  • How to identify which UIcomponent called generic ValueChangeListener? HELP

    Using Jdev. 11.1.1.2.0
    In my jsff I've got an af:iterator that layout components. Each of these component uses the same generic ValueChangeListener.
    In the ValueChangeListener I want to check which component did the change - and for some components issue a PartialTrigger command.
    Problem is; How do I know which component called the listener? I'm not in control of the component Id - so I can't use this. I'm not able to dynamically bind to BackingBean UIcomponent. The ClientAttribute works for af:input but not for af:selectOneChoice...
    Any ideas?

    Hi,
    af:iterator stamps its children, which means that there are no individual component instances created. To PPR a component you refresh the base component (the one that gets stamped). In your case, go with John Stegeman's recommendation or use af:forEach if you need individual component instances to be created. Event then however, John's suggestion will work best
    Frank

  • Problem with SelectBooleanCheckbox

    I'm a beginner with JSF. Trying to get a form working that uses checkboxes (among other things). I have the following column entry in an jspDataTable:
    <h:form>
    <h:dataTable value="#{fnc.objVector}" var="fnc" first="#{fnc.startIndex}" rows="2">
    <f:facet name="header">
    <h:outputText value="#{fnc.fileRange}" />
    </f:facet>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Check In"/>
    </f:facet>
    <h:selectBooleanCheckbox value="#{fnc.bSelectCheckIn}"
    valueChangeListener="#{fnc.selectCheckInBoxChanged}"
    disabled="#{fnc.checkedIn}" />
    </h:column>
    etc. etc. etc.
    The form comes up just fine and the checkbox looks ok. If I click the checkbox, the little checkmark shows on the screen. When I submit the form, the listener routine gets called, and tells me the value of the box is 'true'. So it looks like it is working. But then the web browser gives me the following page:
    ============
    XML Parsing Error: not well-formed
    Location: http://localhost:8084/NCAT/protected/doc_select.faces
    Line Number 40, Column 61:<td><input type="checkbox" name="_id8:_id9:0:_id13" checked disabled="disabled" /></td>
    ------------------------------------------------------------^
    The ^ is under the first 'd' in 'disabled="disabled"' in case this doesn't format properly. Is the problem the string 'disabled="disabled" (which is wrong - the checkbox is NOT disabled) or the 'checked' attribute - which is correct, because I've just put a checkmark in the box....
    If the property fnc.checkedIn comes back true, the checkbox actually does get disabled, and I am not able to change its value, which is good. The problem occurs when the checkbox is not disabled initially, and I try to check it and then submit the form...
    I'm not quite sure where to be looking for the problem. Any help would be appreciated...
    Thanks very much,
    nbc

    It looks like Netbeans is using JSF 1.1 - that is what the libraries indicate. I copied the JSF 1.2 file onto my machine and replaced the 2 jar files jsf-api.jar and jsf-impl.jar in the Netbeans directory .../enterprise3/modules/ext. This directory also has commons-beanutils.jar, commons-collections.jar, commons-digester.jar and commons-logging.jar - I did not replace those. When I rebuild my application and try to run it, Tomcat fails to start - so I obviously have not updated JSF correctly.
    It would be great if you can point me in the right direction here - I'm just about at the limits of my knowledge on Netbeans and well past it on JSF... And I do need to get those checkboxes working...
    Thanks in advance,
    nbc

  • Doubt in f:facet tag.. Please help me ..

    Hi Friends,
    I couldnt resolve the following problem..
    In my screen I have 8 columns.. I have to provide sorting facility for some of the column, which is going to be set dynamically..
    I have written my code like this:
    <h:column rendered="#{RecordListController.recordListBean.flag1}">     <f:facet name="header">          <h:commandLink rendered="#{RecordListController.recordListBean.sortFlag1}"     actionListener="#{RecordListController.processAction}" id="cmdSort1">
    <h:outputText  value="#{RecordListController.recordListBean.headerDesc1}"/>               </h:commandLink>                    <h:outputText                               rendered="#{!RecordListController.recordListBean.sortFlag1}"                                                                      value="#{RecordListController.recordListBean.headerDesc1}"/>/f:facet>                         <h:commandLink action="viewRecordDetail"          actionListener="#{RecordDetailController.processAction}"     styleClass="selectlink" id="cmdSelectRecord">          <h:outputText value="#{recordListBean.recordValue1}" />                              <f:param name="recordKeyValue"                         value="#{recordListBean.keyFieldValue}" />                                        <f:param name="currentRecord" value="#{recordListBean.currentRecordNo}" />                                     </h:commandLink>                              </h:column>  No value is getting displayed as a column header..
    Please help me..
    Message was edited by:
    w4c

    Hi all
    i tried to use a selectBooleanCheckBox within f:facet tag with a valueChangeListener. The call to valueChangeListner is not getting fired when clicking the checkBox.
    when i put the same code outside the f:facet tag it works well.
    code snippet:
    <f:facet name="header">
            <h:selectBooleanCheckbox id="checkAll1" value="#{listBean.allSelected}"
                binding="#{listBean.selectAll}" immediate="true" onklick="submit();"
                valueChangeListener="#{listBean.checkBoxClicked}"/>
    </f:facet>Have anyone encountered the same problem.
    Thanks for your valuable suggestions.
    Regards
    Balaji N
    SCJP

  • How do i pass parameters in selectBooleanCheckbox with f:param...

    I try to pass, for a selectBooleanCheckbox, a parameter.Can i do that?? I try to do it, but the value it isn�t transfered to the JavaBean.
    i put that, but the JavaBean don�t received the "txeka" parameter.
    <h:selectBooleanCheckbox value="#{backing_form_del.markedForDeletion}">
    <f:param name="txeka" value="#{id.usu}" />
    </h:selectBooleanCheckbox>
    Other cuestion, If i achieve that, do i pass all the String parameters to a array of Strings(in the JavaBean)??
    My program consists doing a multiple delete with a database datatable.
    I�ve got a selectBooleanCheckbox, for a each row, and when the selectBooleanCheckbox(s), is(are) checked, i want to do a masive delete when i click a button. Can I do that???
    thanks in advance.
    I�m interesting in JSF aplications, because i�m doing the project final of the informatic ingeniering carrier.
    i appreciatte your help soo much.

    You could use somethings like this:
    <script>
    function setupInventoryReportURL(anchor) {
         var choice = document.getElementById('supplierCenter:inventory:categoryChooser');
         if (choice) {
              var url ='inventoryRPT.jsf' + '?currentCategoryName=' + choice.options[choice.selectedIndex].text;
              anchor.href = url;
         return true;
    </script>
    <h:form id="inventory">
         <h:panelGrid columns="1" border="1" cellpadding="5">
              <f:facet name="header">
                   <h:panelGrid columns="2" width="100%">
                        <h:outputText value="Inventory"/>
                        <h:outputLink value="inventoryRPT.jsf" onclick="setupInventoryReportURL(this)">
                             <h:outputText value="Report" styleClass="commandLink"/>
                        </h:outputLink>
                   </h:panelGrid>
              </f:facet>
    <h:panelGrid columns="2" width="100%">
         <h:panelGroup>
              <h:outputText value="Supply Category"/>
              <h:selectOneMenu id="categoryChooser" value="#{inventory.categoryId}" onchange="submit()"
              valueChangeListener="#{inventoryView.categoryChanged}" immediate="true">
              <f:selectItems value="#{inventory.categories}"/>
         </h:selectOneMenu>
             ..............................................Vladimir Perlov

  • Af:selectBooleanCheckbox inside rows of a af:table

    Hello again:
    I want to do something i was thinking that should be simple, but...
    I have a af:table where in one column i have a af:selectBooleanCheckbox that is related to some data on table's row. Since i give up on building the table using a BC component (Re: ADF BC creating table from view i just put up a ArrayList based on that database table and build my af:table around it.
    Now i want to change some values on each row when it's selected/deselected, so i put in a valueChangeListener.
    However, in my back-end method, how can i know what's the row where the selectBooleanCheckbox that triggered the event is?
    I have access to the component itself - selectBooleanCheckbox - to it's parent - CoreColumn - and to it's parent parent - CoreTable - but how can i do a table.getRowData() withou knowing what was the row where the selectBooleanCheckbox was?
    Thanks again.

    Thanks for your answer, however it didn't helped at all. The problem now is that i can't update the column table under the BC that is "bounded" to the selectBooleanCheckbox. I havd that column as BIT (SQLServer) but then changed to INT, where i store values of 1/0.
    I tryed the aproach of the link you gave (mapping int to boolean), but the pages simply "hangs" when trying to update it.
    UIXTable table = (UIXTable) action.getComponent().getParent().getParent();
    Boolean value = !(Boolean)((CoreSelectBooleanCheckbox)action.getComponent()).getValue();
    Integer id = (Integer)((Object[])table.getRowData())[0];
    Object[] ki = {id};
    Key k = new Key(ki);
    QwebdevicelistViewRow row = (QwebdevicelistViewRow)devices.getRow(k);
    row.setActive(value?1:0);
    qwebAM.getTransaction().commit();
    the code seems to hang in the setActive method.
    Any more hints?
    Thanks a lot.

  • ADF : valueChangeListener is not working on checkbox

    Hi All,
    I am using the following piece of code in ADF and valueChangeListener() associated to my check box is not working.
    Here is the piece of code :
    <af:selectBooleanCheckbox
    label="Budgetary Calendar" id="sbc1"
    selected="false"
    valueChangeListener="#{pageFlowScope.CalendarUtilBean.onBudgetCheckboxChange}"
    autoSubmit="true"/>
    Any help would be greatly appreciated.
    Thanks,
    Srikanth.

    I implemented the same
    valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance()); for my value change listener on select many choice..
    It's working fine !!!
    Thanks
    Kanika

  • Display conditioned selectbooleancheckbox in table

    Hi Forum,
    I've requirement that in a table say there are 2 columns 'status' and 'check'. where check column displays as selectbooleancheckbox.
    1. If the value of status column is 'done' corresponding check column value is 'NA'
    2. If the value of status column is 'under process' corresponding check column value is 'selectbooleancheckbox'
    now if i check 'selectbooleancheckbox' in first row, it should automatically checks another checkbox value in same column based on some condition .
      <af:column sortProperty="prop1" sortable="true"
                                     headerText="test" id="test">    
                            <af:switcher id="s2" facetName="#{row.status == 'done'?'checkbox':'outtext'}">
                                <f:facet name="checkbox">
                                  <af:selectBooleanCheckbox simple="true" text=" " autoSubmit="true"                             
                                                        clientComponent="true"   
                                                        id="sbc1"
                                                        valueChangeListener="#{Bean.OnSelect}">                                                                                                             
                                    </af:selectBooleanCheckbox>
                               </f:facet>
                                <f:facet name="outtext">
                                  <af:outputText value="#{row.row2}" id="ot6"/>
                                </f:facet>
                              </af:switcher>
                          </af:column>
    Bean code:
        public void OnSelect(ValueChangeEvent valueChangeEvent) {
            RichSelectBooleanCheckbox ch = (RichSelectBooleanCheckbox)valueChangeEvent.getSource();
            DCIteratorBinding it = ADFUtils.findIterator(ITERATOR_NAME);
            RowSetIterator rit = it.getRowSetIterator();
            rit.reset();   
            Row curRow = rit.first();
            Row nextRow = rit.next();
            nextRow.setAttribute( "checkbox" , selected ); Please help..
    Thanks.

    989186 wrote:
    now if i check 'selectbooleancheckbox' in first row, it should automatically checks another checkbox value in same column based on some condition .I don't understand this part - What do you mean check another checkbox in same column? Do you have two af:selectBooleanCheckbox in the same column?
    A few things that I notice -
    1) sbc1 is not bound to a value
    2) Your code sets the attribute "checkbox" to selected for the second row in the iterator. Is that what you expect it to do?
    3) I can't see where the "checkbox" attribute is used in the page.
    It would help if you state your requirements a bit more clearly. Even better if you leave out the ADF references and just state the business requirement.

  • Multiple calls to ValueChangeListener through only one change event...

    Hi All,
    I created a datatable that contains a set of records, each record consists of checkbox , name and account ...
    I registered a ValueChangeListener for the checkbox...when I press any of the checkboxes...the method is called for all the checkboxes in the datatable...what if I want only that checked checkbox to be selected...
    A appreciate any help...
    Thanks...
    <h:dataTable value="#{CustomersDB.subCustomers}" var="customers" border="1" id="custtable">
    <!--oracle-jdev-comment:Faces.RI.DT.Class.Key:java.util.List<customers.Customer>-->
    <h:column>
    <h:selectBooleanCheckbox value="false" valueChangeListener="#{Customer.addUserToList}"/>
    </h:column>
    <h:column>
    <h:outputText value="#{customers.name}"/>
    </h:column>
    <h:column>
    <h:outputText value="#{customers.account}"/>
    </h:column>
    </h:dataTable>

    How very weird.  If I step through the change logic (into the JavaFX library source), for each r.setName call line-by-line using the Intellij Idea debugger, then the behavior is as expected and all changes are reported.  If I just run the program without stepping (either inside or outside the debugger), then not all changes are reported (as in your question).  So it seems that stepping through in the debugger somehow triggers the evaluation of some expression which lazily resolves the property change correctly. Schrödinger's cat has been irradiated
    I glanced through the JavaFX 8u40 source and can't work out what is going on.
    I ran my tests on OS X 10.9 and Idea 14.1.
    Log a bug report:
    https://javafx-jira.kenai.com/

  • ValueChangeListener not firing when iterator set to refresh=never

    I have an iterator that I have recently added a child node to. This child node is tied to a view object without a backing entity. The fields in that view can contain user supplied data that I persist through a stored procedure. This mechanism works great accept when the page is refreshed. When that happens the fields in the child node are lost due to the view being reexecuted.
    To fix this problem, I thought I could set the iterator to refresh=”never” and then programmatically refresh it when I need to. This solution appears to work but with one small problem, a valueChangeListener in one of the parent iterator fields fails to execute when it is supposed to.
    It is very weird. I can remove the refresh=”never” from the iterator and the valueChangeListener functions properly, but if I add it back, it fails to get called. I have compared the html source on the browser and the element is generated the same in both instances, so it is definitely some issue on the server side.
    Anyone ever run into a similar problem?
    <af:table rows="#{bindings.ItemCountrySystemsVO.rangeSize}"
              emptyText="#{bindings.ItemCountrySystemsVO.viewable ? \'No rows yet.\' : \'Access Denied.\'}"
              var="row"
              value="#{bindings.ItemCountrySystemsVO.treeModel}">
       <af:selectBooleanCheckbox  id="selectDesc"
                                  value="#{row.CheckBox}"
                                  autoSubmit="true"
                                  immediate="true"
                                  valueChangeListener="#{itemItemCountryDataActionBean.onChangeSystemDescCheckBox}" />
    <iterator id="ItemCountrySystemsVOIterator" RangeSize="10"
                  Binds="ItemCountrySystemsVO" DataControl="RMSItemAMDataControl" Refresh="never"/>
    <tree id="ItemCountrySystemsVO" IterBinding="ItemCountrySystemsVOIterator">
          <AttrNames>
            <Item Value="Item"/>
            <Item Value="CountryId"/>
            <Item Value="SystemCd"/>
            <Item Value="Status"/>
            <Item Value="StatusDate"/>
            <Item Value="PrimarySupp"/>
            <Item Value="CheckBox"/> 
          </AttrNames>
          <nodeDefinition DefName="od.adf.mp.datamodel.views.item.ItemCountrySystemsVO"
                          id="ItemCountrySystemsVONode">
            <AttrNames>
              <Item Value="Item"/>
              <Item Value="CountryId"/>
              <Item Value="SystemCd"/>
              <Item Value="Status"/>
              <Item Value="StatusDate"/>
              <Item Value="PrimarySupp"/>
              <Item Value="CheckBox"/> 
            </AttrNames>
            <Accessors>
              <Item Value="ItemCountrySystemsLangVO"/>
            </Accessors>
          </nodeDefinition>
          <nodeDefinition DefName="od.adf.mp.datamodel.views.item.ItemCountrySystemsLangVO"
                          id="ItemCountrySystemsLangVONode">
            <AttrNames>
              <Item Value="Item"/>
              <Item Value="System"/>
              <Item Value="Lang"/>
              <Item Value="LangDescription"/>
              <Item Value="CountryId"/>
              <Item Value="ItemDescription"/>
              <Item Value="OrigItemDescription"/>
            </AttrNames>
          </nodeDefinition>
        </tree>

    Using the refresh condition was definitely the better approach and it worked great. Unfortunately not refreshing the parent iterator did not prevent the reexecuting of the child node. I am at a loss on how to prevent this from happening. I am at a loss to explain why the reexecuting of the child view object happens at all when the parent hasn't changed.
    Any help is appreciated.

  • ValuechangeListener gets called on navigation

    Dear All,
    I have created my own custom menu model when implementing my train component.
    Please see below code.
    <af:train var="node"
                value="#{menuModel}"
                id="tr1">
      <f:facet name="nodeStamp">
         <af:commandNavigationItem text="#{node.label}"
              action="#{node.action}"
              immediate="#{node.immediate}"
              disabled="#{node.disabled}"
              visited="#{node.visited}"
              id="commandNavigationItem"/>
      </f:facet>
    </af:train>Now, on page 1, I have a booleanCheckBox with autosubmit=true and I added
    a value change listener into it.
    <af:selectBooleanCheckbox text="" label="Page 1 Checkbox"
         id="sbc4"
         autoSubmit="true"
            valueChangeListener="#{pageFlowScope.myBean.onChange}">
    </af:selectBooleanCheckbox>My only problem is this, when I click the Train Command Navigation Item when I want to transition
    to page 2, I notice that my valuechangelistener bean method is called. This is true also, even if I dont select
    the booleancheckbox.
    I am not sure If I miss some JSF concept here but can somebody help me understand if this is normal?
    My thought is that the valuechangelistener gets called only when I do something on that component.
    Thanks
    Thanks

    Hi,
    After some thinking and checking, I notice that I didn't set my component a value.
    <af:selectBooleanCheckbox text="" label="Page 1 Checkbox"
                                  id="sbc4"
                                  autoSubmit="true"
                                  valueChangeListener="#{pageFlowScope.myBean.onChange}"
                                  value="#{pageFlowScope.myBean.checkData}">
    </af:selectBooleanCheckbox>Reading this http://balusc.blogspot.com/2006/09/debug-jsf-lifecycle.html , I realized that maybe it gets called
    because the value might be different so that why my listener is called. Not sure though.
    Thanks again.

Maybe you are looking for