rich:select + a4j:ajax
rui278 Aug 23, 2012 7:08 AMHi, 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:
[code]
LinkedList<String> hours = day.getHoursOfDay();.
youcan = true
[/code]
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
[code]
<a4j:outputPanel >
<rich:panel appendID = "false" id = "out" rendered="true}">
<h:form id = "calendarform">
<h3>From:</h3>
<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"/>
</rich:select>
<a4j:outputPanel id = "from" layout="block">
<rich:select value="#{TemperatureBean.selectedDate}" rendered = "#{TemperatureBean.youcan}"
enableManualInput="false" defaultLabel="Choose Initial time Here"
style="Width:150px">
<f:selectItems value="#{TemperatureBean.getHours()}"/>
</rich:select>
<h3>To:</h3>
<rich:select value="#{TemperatureBean.selectedDateFinal}" rendered = "#{TemperatureBean.youcan}"
enableManualInput="false" defaultLabel="Choose Final time Here"
style="Width:150px">
<f:selectItems value="#{TemperatureBean.getHours()}"/>
</rich:select>
<div style = "float:right" >
<h:commandButton value="Submit Dates" render = "panel"
actionListener="#{TemperatureBean.getList}" submit = "@form">
<f:attribute name="mode" value="5" />
</h:commandButton>
</div>
</a4j:outputPanel>
</h:form>
</rich:panel>
</a4j:outputPanel>
[/code]