p:inputMask for ip address

UI Components for JSF
Post Reply
nishern
Posts: 42
Joined: 14 Nov 2010, 18:58

27 May 2011, 15:31

Hi there..

Im trying to use primefaces <p:inputMask for ip address input but it does not seem to allow me to do this.
I have tried

Code: Select all

<p:inputMask value="#{bean.ip}" mask="999.999.999.999" size="20"/>

but this restricts input to minimum of 3 numeric characters between every ".".
I want it to work for all kind of IP's where example:
"xxx.xx.xxx.x"
"xxx.x.xx.xx"
"xxx.xx.xxx.xxx"

Thanks in advance...
Nish

nishern
Posts: 42
Joined: 14 Nov 2010, 18:58

02 Jun 2011, 08:47

Hi there,

Not sure what you meant by "mask your ip address with any other ip address"?
Im someone out there has had a similar problem:) and has found a fix...
you are right it is a tough one to crack....

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

02 Jun 2011, 08:54

That comment was from a spam user so I've deleted.

Currently masked input does not support this so it must be fixed number of characters, something we are trying to improve soon.

nishern
Posts: 42
Joined: 14 Nov 2010, 18:58

02 Jun 2011, 09:00

Hi there...
Thanks for the update... eagerly await that functionality :)


flawesome
Posts: 6
Joined: 22 Apr 2022, 10:05

11 May 2022, 11:57

Unfortunately the inputMask does not really work well for an IP address.

Instead you could use a regular input field with a keyFilter and RegEx to accomplish this.

Here an example of how this could look like:
https://stackblitz.com/edit/github-a94a ... onent.html

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests