This content has been marked as final.
Show 5 replies
-
1. Re: Update rich:comboBox
richy Jul 15, 2008 10:52 PM (in response to richy)This is what i tried :
<rich:comboBox id="csp1" value="#{TableCsp.csp1Selected}" suggestionValues="#{TableCsp.test}" directInputSuggestions="true" defaultLabel="Sélectionner une csp"> <a4j:support event="onselect" reRender="csp2" action="#{TableCsp.updateCsp2}"/> </rich:comboBox> <rich:comboBox id="csp2" suggestionValues="#{TableCsp.test2}" directInputSuggestions="true" defaultLabel="Sélectionner une csp"> </rich:comboBox>
and my TableCsp.java :public class TableCsp { List<String> test; String csp1Selected; List<String> test2; String csp2Selected; DBConnection db; Connection conn; Statement stat; String query; public TableCsp() throws SQLException { test = new ArrayList<String>(); test2 = new ArrayList<String>(); db = new DBConnection(); conn = db.getConnection(); stat = conn.createStatement(); query = "SELECT * FROM csp_n1 "; ResultSet rs = stat.executeQuery(query); while(rs.next()){ test.add(rs.getString("libelle")); } } public void updateCsp2() throws SQLException{ query = "SELECT * FROM csp_n1 WHERE libelle = '"+csp1Selected+"'"; ResultSet rs = stat.executeQuery(query); rs.next(); String code = rs.getString("code_csp_n1"); query = "SELECT * FROM csp_n2 WHERE code_csp_n1 = '"+code+"'"; rs = stat.executeQuery(query); while(rs.next()){ test2.add(rs.getString("libelle")); } }
-
2. Re: Update rich:comboBox
richy Jul 16, 2008 5:58 AM (in response to richy)I added immediate="true" in the rich:combobox and in the a4j:support, and now it goes in function updateCsp2. But the problem is that csp1Selected is always null, so the request cant work :/
-
3. Re: Update rich:comboBox
richy Jul 16, 2008 12:03 PM (in response to richy)I finally done it using a binding property on my combobox component :D
-
4. Re: Update rich:comboBox
strannik Dec 1, 2008 11:26 AM (in response to richy)Unfortunately the last workaround doesn't work with me :(
When action(bean.update) on the server side occurs the combobox value is not submitted yet and year is null. Is there any way to perform AJAX requests and have combobox value submitted?<rich:comboBox value="#{bean.year}" id="year" immediate="true" binding="#{bean.component}"> <f:selectItem itemValue="2009" /> <f:selectItem itemValue="2008" /> <f:selectItem itemValue="2007" /> <a4j:support event="onblur" reRender="comp" immediate="true" action="#{bean.update}" /> </rich:comboBox>
-
5. Re: Update rich:comboBox
nbelaevski Dec 1, 2008 3:16 PM (in response to richy)Hello,
Try onselect in combination with onkeyup