My code is as follows:
<h:selectOneMenu id="servicestatus1" value="#{ServiceBean.status}" valueChangeListener="#{ServiceBean.statusChanged}" disabled="#{not LoginBean.prototypeUser && ServiceBean.old }">
<f:selectItems value="#{ServiceBean.statusList}"/>
</h:selectOneMenu>
public void statusChanged(ValueChangeEvent event) throws SQLException, Exception{
System.out.println("In the status changed value change listener");
FacesContext context = FacesContext.getCurrentInstance();
String prevCategorySelected = (String)event.getOldValue();
String newCategorySelected = (String)event.getNewValue();
if(!newCategorySelected.equalsIgnoreCase(prevCategorySelected)){
// Value changed. Change the drop down values.
log.info("The values are: "+prevCategorySelected+" - "+newCategorySelected);
if(newCategorySelected.equals("Other")){
otherStatusSelected = true;
}
else{
otherStatusSelected = false;
}
}
}
When the user clicks on the dropdown and the valuechangelistener fires, all the data that has already been filled for the other fields is getting lost. Its as if the form is reset. Does any one know how to solve this? Any help is appreciated.
Thank you,
-M
Do you Yahoo!?
Get on board. You're invited to try the new Yahoo! Mail.

