I am using JSF 2.2 with PrimeFaces 6.1 and, in order to make an "optional" validation, every time the p:inputNumber loses focus, a p:button is updated and it is rendered or not based on a specific validation method:
<div class="ui-grid-col-2">
<p:inputNumber id="quantidade" value="#{vendaMB.quantidadeItem}" decimalPlaces="1" minValue="0.0" onfocus="this.setSelectionRange(0, this.value.length)">
<p:ajax event="blur" process="@this" update="btnImgQtdeUltrapassa"/>
</p:inputNumber>
</div>
<div class="ui-grid-col-1">
<p:button id="btnImgQtdeUltrapassa" title="Quantidade inserida ultrapassa quantidade em estoque" disabled="true" icon="fa fa-fw fa-warning" rendered="#{vendaMB.verificaQtdeEstoque()}" styleClass="btn-round"/>
</div>
Strangely, when I use update="@form"
, the update happens perfectly, but there are other processes and methods that can't be re-executed on this form update, therefore, I can't use this approach. Could someone help me solve this problem?
Also, I am using a "p:button" but I actually just need the icon and something similar to its "title" attribute. I'd be grateful if you could also suggest me another tag or approach to use instead of this "improvised icon".