Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ValueChangeListener

 
sreedhar yadagini
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got a dropdown box and a inputtext box and based on the selection of the dropdown box the input box is enabled/disabled. I am using the JSF and using the valuechangelistner with the h:selectOneMenu. The code snippet is as follows

<h utputLabel for="morningstar">
<h:selectOneMenu valueChangeListener="#{morningStarBean.processValueChanged}" immediate="true" onchange="submit()" value="morningstar" styleClass="values">
<f:selectItem itemValue="blank" itemLabel="" />
<f:selectItem itemValue="TwoFifty" itemLabel="$250.00"/>
<f:selectItem itemValue="ManualEntry" itemLabel="Manual Entry"/>
</h:selectOneMenu>
<h:inputText value="#{morningStarBean.newValue}" required="false" disabled="#{morningStarBean.result}" size="6" maxlength="6"/>

and the bean looks like this

public void processValueChange(ValueChangeEvent event) throws AbortProcessingException{
newValue= (String)event.getNewValue();
System.out.println(newValue);
FacesContext.getCurrentInstance().renderResponse();
}

But it's not helping me in anyway. It's not getting the changed value based on which I enable or disable the text box. Any help would be highly appreciated.
 
Ganesh Gowtham
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
y wont u use the pure java script if it is entrirley Client Side...
using getelementById("formId:ControlID").style.display = "none" or inline
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic