visseri
visseri

Reputation: 13

How i can keep value in p:inputMask after the focus lost

I have a problem with InputMask component in Primefaces v.5. My case: i enter a few characters in the field, but do not fill it completely. After that i move to another field. InputMask lost its focus and value has been erased. But why? How can I fix this?

Upvotes: 1

Views: 2966

Answers (1)

Bonifacio
Bonifacio

Reputation: 1502

By default, <p:inputMask> reset its own value if the data entered is incomplete. You can change this behavior by setting the attribute autoClear to false.

Example:

<p:inputMask id="date" autoClear="false" value="#{bean.date}" mask="99/99/9999"/>

For more information, at page 253 of the PrimeFace's v5 Documentation there's a complete guide of how the <p:inputMask> component should behave.

Upvotes: 2

Related Questions