Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSF
Search Coderanch
Advance search
Google search
Register / Login
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
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JSF
How to use ValueChangeLister attribute in selectOnemenu
sudhasrinivas pallam
Ranch Hand
Posts: 37
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi friends
This is Srinivas Iam trying to use valueChangeListener in the below code but it is not working
<%@ page language="java" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://www.infragistics.com/faces/netadvantage" prefix="ig"%> <f:view> <html> <script type="text/javascript"> function submit1(){ alert("submit here"); alert(document.forms['testFormOne'].Elements['testFormOne:update1'].value); document.forms['testFormOne'].Elements['testFormOne:update1'].style.display='inline'; } </script> <body> <h:form id="testFormOne"> <ig:sidebar style="width: 300px; height: 200px;"> <h:panelGrid columns="2"> <h:outputText value="Select Doc Type" /> <h:selectOneMenu value="#{example.updateValue1}" id="update1" onchange="submit1()" valueChangeListener="example.processValueChange"> <f:selectItems value="#{example.updateList1}" /> </h:selectOneMenu> </h:panelGrid> </ig:sidebar > </h:form> </body> </html> </f:view>
import javax.faces.model.SelectItem; //import java.util.ArrayList; import java.util.List; import java.util.ResourceBundle; import java.util.*; import javax.swing.*; import javax.faces.event.*; public class ExampleFormBean implements ActionListener,ValueChangeListener { private List updateList1 = new ArrayList(); private String updateValue1 = ""; private List updateList2 = new ArrayList(); private String updateValue2 = ""; public void processAction(ActionEvent e) { JOptionPane.showMessageDialog(null,"Hi"); } public List getUpdateList1() { ResourceBundle r = ResourceBundle.getBundle("ExampleBundle"); updateList1.add( new SelectItem("Cust", r.getString("customer"), "" )); updateList1.add( new SelectItem("Vouch", r.getString("voucher"), "" )); updateList1.add( new SelectItem("Vend", r.getString("vendor"), "" )); updateList1.add( new SelectItem("ProsBy", r.getString("procesBy"), "" )); updateList1.add( new SelectItem("BusUnit", r.getString("bussunit"), "" )); return updateList1; } public void setUpdateValue2(String value2) { updateValue2=value2; } public String getUpdateValue2() { return updateValue2; } public void setUpdateValue1(Object upvalue) { updateValue1=(String)upvalue; callValue(); } public String getUpdateValue1() { return updateValue1; } /* public List getUpdateList1() { return updateList1; }*/ public List getUpdateList2() { return updateList2; } public void callValue() { if(updateValue1.equals("Cust")||updateValue1.equals("Customer")) { updateList2.add(new SelectItem("id","CustomerId")); updateList2.add(new SelectItem("name","Customer Name")); updateList2.add(new SelectItem("add","Customer Address")); updateList2.add(new SelectItem("num","Customer Number")); } } public void processValueChange(ValueChangeEvent ce) { JOptionPane.showMessageDialog(null, ce.getSource()); } }
\
help me out please
Anu Sri
Greenhorn
Posts: 16
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
Try like this
<h:selectOneMenu value="#{example.updateValue1}" id="update1" onchange="submit()" valueChangeListener="#{example.processValueChange}"> <f:selectItems value="#{example.updateList1}" /> </h:selectOneMenu>
Bring out your dead! Or a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
JSF h:selectOneMenu concern
Problem in populating textbox in jsf on clicking submit button
f:selectItems can't set value
problem when working with selectOneListbox
f:selectItem
More...