Count Characters Used In P:inputTextarea Instead Of Characters Remaining
I posted a similar question earlier but I'm looking for a different approach. I have a inputTextArea and I need to limit the amount of characters that can be entered in to it as we
Solution 1:
Liam,
It's very simple, forget the counter and get the string length:
<p:inputTextarea id="ogdGacOther" rows="1" maxlength="50"
value="#{rfeBean.rfe.targetOfficerReasonsForReferral.otherOgdGac}">
<p:ajax event="keyup" update="displayGacCharCount" global="false"/>
<p:ajax event="keydown" update="displayGacCharCount" global="false"/>
<p:ajax event="keypress" update="displayGacCharCount" global="false"/>
</p:inputTextarea>
<h:outputText id="displayGacCharCount"
value="#{rfeBean.rfe.targetOfficerReasonsForReferral.otherOgdGac.length()}"/>
Post a Comment for "Count Characters Used In P:inputTextarea Instead Of Characters Remaining"