I have dialogbox which consists an autocomplete element and several other fields depending on it. What I want is to run completeMethod when autocomplete field is empty. However, this method executes only there is one or more character in the field. For instance, assume I typed 'x', then if I remove it, it should be called. I need to know if it is empty because I will change other fields according to it. I already tried minLength but it has no effect whatsoever
<p:autoComplete id="findCommand" value="ControllerClass.someObject
completeMethod="#{ControllerClass.completeCommand-returns objects-}/..>
<p:ajaxlistener="#{ControllerClass.onCommandChange} update="someotherfield"
event="itemSelect" /></p:autoComplete>
The completeCommand method won't be called if the field is empty. Here is what I tried:
1- I added an ajax tag with change and assigned some other method to it to control the field. But it
ruins itemSelect ajax, since it tries to assign query string to object when user types something, which is wrong.
2- I tried to use second answer, however since I can't figure out if field is empty, it has no use:
JSF access html element value in bean class