selected value in Dropdown doesn't change after processValueChanged
When I select a value in a drop down box which is set to send automaticaly modifications I have the folowing message:
com.sun.rave.web.ui.component.DropDown::The current value of component form1:yearDropDown does not match any of the selections.
Did you forget to reset the value after changing the options?
Add to that the selected value is not selected in the drop down after the refreshing.
Could you please help me to solve this problem.
Here's my code:
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<ui:page binding="#{test1.page1}" id="page1">
<ui:html binding="#{test1.html1}" id="html1">
<ui:head binding="#{test1.head1}" id="head1">
<ui:link binding="#{test1.link1}" id="link1" url="/resources/stylesheet.css"/>
</ui:head>
<ui:body binding="#{test1.body1}" id="body1" style="-rave-layout: grid">
<ui:form binding="#{test1.form1}" id="form1">
<h:panelGrid binding="#{test1.gridPanel2}" columns="4" id="gridPanel2" style="left: 20px; top: 30px; position: absolute">
<ui:dropDown binding="#{test1.yearDropDown}" id="yearDropDown" items="#{test1.yearDropDownDefaultOptions.options}"
onChange="common_timeoutSubmitForm(this.form, 'gridPanel2:yearDropDown');" valueChangeListener="#{test1.yearDropDown_processValueChange}"/>
<ui:textField binding="#{test1.dateTextField}" id="dateTextField" label="Year" readOnly="true"/>
</h:panelGrid>
</ui:form>
</ui:body>
</ui:html>
</ui:page>
</f:view>
</jsp:root>
publicclass test1extends AbstractPageBean{
publicvoid init(){
//(...)
initYearDropDown();
}
privatevoid initYearDropDown()
{
int firstYear = 2000;
int lastYear = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR);
Option[] yearsList =new Option[lastYear-firstYear+1+1];
yearsList[0] =new Option(Integer.valueOf(-1),"SELECT YEAR");
for (int i = 0 ; i < lastYear-firstYear+1; i++)
yearsList[i+1] =new Option(Integer.valueOf(i), String.valueOf(firstYear+i));
yearDropDownDefaultOptions.setOptions(yearsList);
}
privatevoid refreshDateTextFieldText()
{
year = ((Integer)yearDropDown.getSelected()).intValue();
dateTextField.setText(year);
}
publicvoid yearDropDown_processValueChange(ValueChangeEvent event)
{
refreshDateTextFieldText();
}
}

