5 Replies Latest reply on Aug 24, 2012 5:50 AM by Rui Albuquerque

    rich:select + a4j:ajax

    Rui Albuquerque Newbie

      Hi, so i'm trying to make two rich:selects work dinamicaly, depending on what i chose in the first rich select. The class Day has two atributes: a string with the day and a list of strings with the hours


      I want to chose the day from the first combo box, and then i want the other two comboboxes to be populated with the hours of the chosen day.


      The value changed method:


      LinkedList<String> hours = day.getHoursOfDay();.

      youcan = true



      Can anyone help me? Because when i select the day in the first combobox, the second ones aren't rendered...


      Bellow goes the xhtml code



      <a4j:outputPanel >

                                              <rich:panel appendID = "false" id = "out" rendered="true}">

                                                        <h:form id = "calendarform">



                                                                  <rich:select value="#{TemperatureBean.day}"

                                                                                      enableManualInput="false" defaultLabel="Choose Day Here"

                                                                                      style="Width:150px" valueChangeListener = "#{TemperatureBean.valueChanged}">

                                                                            <f:selectItems value="#{TemperatureBean.getDays()}" var="day"

                                                                                      itemLabel="#{day.getDay()}" />

                                                                            <f:converter converterId="DayConverter" />

                                                                            <a4j:ajax event="change" render = "from" execute="@this"/>


                                                                  <a4j:outputPanel id = "from" layout="block">


                                                                            <rich:select value="#{TemperatureBean.selectedDate}"  rendered = "#{TemperatureBean.youcan}" 

                                                                                                enableManualInput="false" defaultLabel="Choose Initial time Here"


                                                                                      <f:selectItems value="#{TemperatureBean.getHours()}"/>






                                                                            <rich:select value="#{TemperatureBean.selectedDateFinal}" rendered = "#{TemperatureBean.youcan}"

                                                                                                enableManualInput="false" defaultLabel="Choose Final time Here"


                                                                                      <f:selectItems value="#{TemperatureBean.getHours()}"/>



                                                                            <div style = "float:right" >

                                                                                      <h:commandButton value="Submit Dates" render = "panel"

                                                                                                           actionListener="#{TemperatureBean.getList}" submit = "@form">

                                                                                                <f:attribute name="mode" value="5" />