Improve this doc View source

pfRemainingCharsCount
directive in module patternfly.form

Description

Directive for showing a characters remaining count and triggering warning and error
behavior when passing specified thresholds. When the chars-warn-remaining threshold is passed,
the chars-warn-remaining-pf css class is applied to the count-fld, which by default, turns
the remaining count number red.
By default, characters may be entered into the text field after the chars-max-limit limit has been reached,
the remaining count number will become a negative value. Setting the blockInputAtMaxLimit to true,
will block additional input into the text field after the max has been reached; additionally a right-click 'paste' will only
paste characters until the maximum character limit is reached.

Usage

as attribute
<ANY pf-remaining-chars-count
     ng-model="{string}"
     count-fld="{string}"
     chars-max-limit="{string}"
     chars-warn-remaining="{string}"
     [block-input-at-max-limit="{boolean}"]>
   ...
</ANY>

Parameters

ParamTypeDetails
ng-modelstring

The scope model variable which contains the initial text for the text field. Required, but
can be an emptly string ("").

count-fldstring

The id of the field to display the 'characters-remaining' count.

chars-max-limitstring

Number representing the maximum number of characters to allow before dispatching a
'overCharsMaxLimit' event. When the number of characters falls below chars-max-limit, a 'underCharsMaxLimit'
event is dispatched.

chars-warn-remainingstring

Number of remaining characters to warn upon. The 'chars-warn-remaining-pf'
class will be applied to the count-fld when the remaining characters is less than the
chars-warn-remaining threshold. When/if the number of remaining characters becomes greater than the
chars-warn-remaining threshold, the 'chars-warn-remaining-pf' class is removed from the count-fld field.

block-input-at-max-limit
(optional)
boolean

If true, no more characters can be entered into the text field when the
chars-max-limit has been reached. If false (the default), characters may be entered into the text field after the
max. limit has been reached, but these additional characters will trigger the 'overCharsMaxLimit' event to be
dispatched. When blockInputAtMaxLimit is true, a right-click 'paste' will only paste
characters until the maximum character limit is reached.

Example

Source





Demo