Primefaces extension keyfilter doesn't allow to paste values

Community Driven Extensions Project
Post Reply
anatoly314
Posts: 34
Joined: 12 Feb 2014, 17:03

25 Aug 2014, 09:38

I'm using keyfilter from Primefaces extensions library, <pe:keyfilter/>. I use it together with regular expression which permits only numbers to be input. Everything works fine except that I can't paste a value into a field even if it fulfills regex. I mean I can't perform ctrl+v or right click -> paste with the mouse.

Is there workaround of this issue?

Or should I just use another validation method?
I use Primefaces 5.1 with Apache MyFaces 2.0.2 and Websphere 8.0.0.9

tandraschko
PrimeFaces Core Developer
Posts: 3619
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

25 Aug 2014, 10:46

Set preventPaste to false.

But, e.g. if you only allow numbers and paste a text, it won't be removed. It's just a keyfilter, no mask.
Thomas Andraschko

PrimeFaces Developer | PrimeFaces Extensions Founder

Apache Member | PMC @ OpenWebBeans, DeltaSpike, MyFaces, BVal | Contributor @ TomEE

Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

anatoly314
Posts: 34
Joined: 12 Feb 2014, 17:03

19 Oct 2014, 07:58

Thank you, I added also back-end validation to overcome this issue.
I use Primefaces 5.1 with Apache MyFaces 2.0.2 and Websphere 8.0.0.9

nandish
Posts: 7
Joined: 30 Jan 2018, 08:27

13 Mar 2018, 11:06

tandraschko wrote:
25 Aug 2014, 10:46
Set preventPaste to false.

But, e.g. if you only allow numbers and paste a text, it won't be removed. It's just a keyfilter, no mask.
Is there any way to apply filter to paste also? eg. when I paste text on number only field??

tandraschko
PrimeFaces Core Developer
Posts: 3619
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

13 Mar 2018, 11:20

No. It's a keyfilter, not a mask. I would use inputMask or something.
Thomas Andraschko

PrimeFaces Developer | PrimeFaces Extensions Founder

Apache Member | PMC @ OpenWebBeans, DeltaSpike, MyFaces, BVal | Contributor @ TomEE

Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

nandish
Posts: 7
Joined: 30 Jan 2018, 08:27

13 Mar 2018, 11:30

tandraschko wrote:
13 Mar 2018, 11:20
No. It's a keyfilter, not a mask. I would use inputMask or something.
Ya, but inputMask is a separate input field I need to add filter to existing one's . And does inputMask allows RegExp in mask field?

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest