Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

on change combo box not working.

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Iam trying to do onchange selectOneMenu is not working but if I put submit button it is working?(I am using valueChangeListener).
any body can help ...when I onchange my combo box, I want to change value in down side combo box ....actually when I select state combobox, only it has to disply cities in my down combobox.
 
Kondal reddy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my JSP:


<h:selectOneMenu styleClass="selectOneMenu" id="menu1" value="#{deemListBean.tempState}" onchange="submit();" valueChangeListener="#{deemListBean.listenerStateName}" >

<f:selectItems value = "#{deemListBean.getState}" />
</h:selectOneMenu>

<h:selectOneMenu styleClass="selectOneMenu" id="menu2" value="#{deemListBean.tempCity}" >

<f:selectItems value = "#{deemListBean.getCity}" />
</h:selectOneMenu>

<hx:commandExButton type="submit" value="Submit"
styleClass="commandExButton" id="button1"></hx:commandExButton>


And my Backing Bean is:


public void listenerStateName(ValueChangeEvent vce){


System.out.println("inside listenerStateName");
String value = "";

value = (String)vce.getNewValue();

System.out.println("********* The new Value is = "+value);
FacesContext fc = FacesContext.getCurrentInstance();
fc.renderResponse();
deemListBO= this.serviceLocator.getConcreteDeemListService().getCity(value);
setCity(deemListBO.getCity());
System.out.println("********* The new Value is = "+city);



}

any body can help.
 
Kondal reddy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my JSP:


<h:selectOneMenu styleClass="selectOneMenu" id="menu1" value="#{deemListBean.tempState}" onchange="submit();" valueChangeListener="#{deemListBean.listenerStateName}" >

<f:selectItems value = "#{deemListBean.getState}" />
</h:selectOneMenu>

<h:selectOneMenu styleClass="selectOneMenu" id="menu2" value="#{deemListBean.tempCity}" >

<f:selectItems value = "#{deemListBean.getCity}" />
</h:selectOneMenu>

<hx:commandExButton type="submit" value="Submit"
styleClass="commandExButton" id="button1"></hx:commandExButton>


And my Backing Bean is:


public void listenerStateName(ValueChangeEvent vce){


System.out.println("inside listenerStateName");
String value = "";

value = (String)vce.getNewValue();

System.out.println("********* The new Value is = "+value);
FacesContext fc = FacesContext.getCurrentInstance();
fc.renderResponse();
deemListBO= this.serviceLocator.getConcreteDeemListService().getCity(value);
setCity(deemListBO.getCity());
System.out.println("********* The new Value is = "+city);



}

any body can help.
 
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the scope of your managed bean?
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add



to the selectOneMenu tag and it should work. This will "short circuit" the lifecyle and be handled right away instead of being queued and processed later when submitted.
 
I was her plaything! And so was this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic