3 Replies Latest reply on Mar 31, 2011 7:23 AM by ssilvert

    rich:comboBox and a4j:support onselect

    stefanorg

      Hi all,

       

      i want to test the selection of a combobox that reRender an area onselection my code is:

       

      <rich:comboBox id="periodoCombo" value="#{sf_periodo}" defaultLabel="Seleziona Periodo"
                                                        enableManualInput="true" required="true"
                                                        requiredMessage="E' necessario selezionare un periodo" width="412">
                                                        <f:selectItem itemValue="Ultima settimana" />
                                                        <f:selectItem itemValue="Ultimo mese" />
                                                        <f:selectItem itemValue="Personalizzato" />
                                                        <a4j:support status="mainStatus" event="onselect" reRender="dataCtr"/>
                                              </rich:comboBox>
      
      
      

       

      when i select "Personalizzato" i want to reRender dataCtr, that shows 2 rich:calendar:

       

      <a4j:outputPanel id="dataCtr" layout="block">
        <rich:calendar id="dataInizioCalendar" value="#{sf_dataInizio}" datePattern="dd/M/yy HH:mm"
                                                                  defaultTime="00:00" rendered="#{sf_periodo eq 'Personalizzato'}"
                                                                  required="true" requiredMessage="Selezionare Data Inizio">
                                                                  <a4j:support status="mainStatus" event="onchanged" reRender="searchPnl" />
                                                        </rich:calendar>
      
                                                        <rich:calendar id="dataFineCalendar" value="#{sf_dataFine}" datePattern="dd/M/yy HH:mm"
                                                                  defaultTime="23:59" rendered="#{sf_periodo eq 'Personalizzato'}"
                                                                  required="true" requiredMessage="Selezionare Data Fine">
                                                                  <a4j:support status="mainStatus" event="onchanged" reRender="searchPnl"/>
                                                        </rich:calendar> 
      
       </a4j:outputPanel>
      
      
      
      
      
      
      

      The problem is that when i do:

       

      RichFacesClient rich = new RichFacesClient(this.client);
      
      
                          //il combo box e' un elemento di richfaces quindi utilizzo le facility del RichFacesClient
                          rich.setComboBox("periodoCombo", "Personalizzato");
                          //controllo se presenti data inizio e data fine
      
        rich.setCalendarValue("dataInizioCalendar", "1/11/11 00:00");
      
      
      

       

      i get an error "No component ID was found for dataInizioCalendarInputDate" because the dataInizioCalendar is not renderd, to test that i've used:

       

      assertEquals(false, this.server.findComponent("dataInizioCalendar").isRendered());
      

       

      Does the rich.setComboBox(...) fires the onselect event? What i'm doing wrong?

       

      Thanks

        • 1. rich:comboBox and a4j:support onselect
          ssilvert

          I don't see how this related to JSFUnit.  Moved to RichFaces forum.

           

          Stan

          • 2. rich:comboBox and a4j:support onselect
            stefanorg

            Hi Stan,

             

            when i use the browser the component work correctly, but when i'm inside the WebClient, trying to test it the component is not re-render ... isn't this jsfunit related?

            • 3. rich:comboBox and a4j:support onselect
              ssilvert

              Stefano C wrote:

               

              Hi Stan,

               

              when i use the browser the component work correctly, but when i'm inside the WebClient, trying to test it the component is not re-render ... isn't this jsfunit related?

              In that case, yes it is.  Sorry, I misread your post.  Now it looks like I'm unable to move this thread back to the JSFUnit forum.

               

              I don't know exactly what events are fired, but JSFUnit/HtmlUnit will fire whatever events would be fired if the user set the combo box.  So if that causes the page to get rid of the rich:calender then that's probably what is happening.  You can verify this manually with FireBug.

               

              Stan