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

    rich:comboBox and a4j:support onselect

    Stefano C Newbie

      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"/>


      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 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"/>

      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?