I am using JSF with Primefaces 5.3 and having trouble with enabling/disabling a commandButton.
First of all, I have this input:
<h:inputText id="series" value="#{bean.series}"
required="false" converterMessage="Please enter three digits" >
<f:validateRegex pattern="[0-9]{3}" />
<p:ajax event="keyup" update="download"/>
</h:inputText>
In the backing bean, this field is an Integer
private Integer series;
And my goal is to enable/disable a 'download' button, whenever the input is not empty. I do not care if it is not valid, but only if it contains no characters.
<h:commandButton id="download" value="Download"
action="#{bean.download}"
disabled="#{empty bean.series}"/>
The update event is triggered on keyup, but because of the validation, the attribute 'series' in the backing bean is always null.
Could you please help me with a solution? Thanks