I've got an autocomplete with a validator - if I submit a query of 'AAA' to the autocomplete, then I get a list of suggestions beginning with 'AAA'. I selected 'AAA001', then the validator is called, but in the validator the value is 'AAA' when I'm expected 'AAA001'.
Here is my code:
<p:autoComplete id="codeAutoComplete"
completeMethod="#{BEAN.autoCompleteCode}"
minQueryLength="3" forceSelection="true"
value="#{OBJECT.code}"
validator="#{BEAN.validateCode}" >
<f:attribute name="object" value="#{OBJECT}" />
<p:ajax listener="#{BEAN.onCodeSelect}"
update="form"/>
</p:autoComplete>
code is simply a String with a getter and setter and my validator:
public void validateCode(FacesContext ctx, UIComponent component, Object value) {
String code = (String) value;
...
}
And instantly code = 'AAA' rather than the expected 'AAA001'. I added the object attribute just to ensure that 'AAA001' wasn't already set on the object, but as expected it wasn't.
Is there anything I can do to get the selected value rather than the submitted one?
Thanks