What i want to achieve now is that the value of the <p:inputText/> is available in my autocomplete Method. Is there a way to get this working?
Here is my test page:
Code: Select all
<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<p:log id="log" />
<h:form id="test_form">
<p:outputLabel for="fieldOne" value="fieldOne " />
<p:inputText id="fieldOne" value="#{testBean.fieldOne}"/>
<p:outputLabel for="fieldTwo" value="fieldTwo " />
<p:autoComplete id="fieldTwo" value="#{testBean.fieldTwo}" completeMethod="#{testBean.autocomplete}" >
<p:ajax event="query" partialSubmit="false"></p:ajax>
</p:autoComplete>
</h:form>
</h:body>
</html>
Code: Select all
@ManagedBean(name="testBean")
@ViewScoped
public class TestBean {
private String fieldOne;
private String fieldTwo;
public String getFieldOne() {
return fieldOne;
}
public void setFieldOne(String fieldOne) {
this.fieldOne = fieldOne;
}
public String getFieldTwo() {
return fieldTwo;
}
public void setFieldTwo(String fieldTwo) {
this.fieldTwo = fieldTwo;
}
public List<String> autocomplete(String query){
return new ArrayList<String>();
}
}
When i type something in my autocomplete field the autocomplete method gets successfully called.
But the value of fieldOne is not available. Because of the
the request Parameter contains the value of fieldOne but the Setter is never being called.<p:ajax event="query" partialSubmit="false"></p:ajax>
This are the POST DATA:
Tested on Primefaces 5.0 and Mojarra 2.1.7test_form:fieldTwo_input=a,
test_form:fieldOne=test,
javax.faces.partial.render=test_form:fieldTwo,
javax.faces.partial.execute=test_form:fieldTwo,
test_form=test_form, javax.faces.source=test_form:fieldTwo,
test_form:fieldTwo_query=a,
javax.faces.behavior.event=query,
javax.faces.partial.event=query,
javax.faces.partial.ajax=true,
javax.faces.ViewState=-5194014525765824611:-2692512311297763706
Thank you in advance for your help!