-
1. Re: Combobox binding problem
nbelaevski Jul 13, 2010 5:25 PM (in response to dracola24)Hi,
Use "value" attribute to get selected object on server like this <... value="#{bean.selectedObject}" >
-
2. Re: Combobox binding problem
dracola24 Jul 14, 2010 3:37 AM (in response to nbelaevski)I have try it, but with the same result.
getValue() is still null :s
More ideas please??
Thanks
-
3. Re: Combobox binding problem
nbelaevski Jul 14, 2010 4:31 AM (in response to dracola24)I should work, please post full page & bean code.
-
4. Re: Combobox binding problem
dracola24 Jul 14, 2010 4:45 AM (in response to nbelaevski)Page code with your suggest included:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:sec="http://www.springframework.org/security/facelets/tags"
>
<nav><a4j:outputPanel id="navigation" >
<div id="box-categories">
<b>Filter by topic</b>
<rich:inplaceSelect id="cat1" value="#{interfaceContainer.documentFormContainer.selectOnes['cat1'].value}" onchange="javascript:refreshResults(); return false;">
<f:selectItems value="#{interfaceContainer.documentFormContainer.selectOnes['cat1'].items}" />
</rich:inplaceSelect>
<b>and subtopic</b>
<rich:comboBox id="cat2" value="#{interfaceContainer.documentFormContainer.selectOnes['cat2'].value}" onchange="javascript:refreshResults();" >
<f:selectItems value="#{interfaceContainer.documentFormContainer.selectOnes['cat2'].items}" />
</rich:comboBox>
</div>
</a4j:outputPanel>
</nav>
</ui:composition>Java code:
public String getStringValue(){
if ( this.selectOne ==null || this.getSelectOne().getValue()==null)
return "";
return this.getSelectOne().getValue().toString();
}Thanks for your answers
-
5. Re: Combobox binding problem
nbelaevski Jul 14, 2010 5:08 AM (in response to dracola24)What is "interfaceContainer.documentFormContainer.selectOnes['cat1'].value"? Where is "stringValue" used?
Also value needs to be submitted to the server, so you should have form and some submitting component like a4j:commandLink or a4j:support.
-
6. Re: Combobox binding problem
dracola24 Jul 14, 2010 5:50 AM (in response to nbelaevski)interfaceContainer.documentFormContainer.selectOnes['cat1'].value is a value which is in a solr document, which was indexed before.
Regarding the html code of the page, I get:
<input type="text" value="Guardia"/>
So I need to send 'value' information to the backend, and I do it with this.getSelectOne().getId();, but here is when I get null value.
Thanks for your answers
-
7. Re: Combobox binding problem
nbelaevski Jul 14, 2010 6:33 AM (in response to dracola24)and I do it with this.getSelectOne().getId();, but here is when I get null value
Can you please explain in more details? Even better, create small example including full code and attach it here. Obtaining input value is pretty straightforward, so I'm not getting why you have problems with it.