regular expression with primefaces keyfilter

Community Driven Extensions Project
Post Reply
santhoshsamala
Posts: 26
Joined: 23 Feb 2012, 18:10

10 Apr 2012, 21:29

I'm trying to validate a US phone number with primefaces extensions keyFilter. The code is

Code: Select all

<p:inputText id="amBusinessContactNum" 
								value="#{customerOverviewAction.customerOverviewBean.amBusinessContactNum}"
								label="amBusinessContactNum" >
								<pe:keyFilter regEx="/^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/"/> 
								</p:inputText>
Its not considering any input for this. do i need to change anything here?
Using primefaces3.2, jboss7.0.2, weld 1.1.5

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

10 Apr 2012, 22:31

Your code looks good. Are you sure this is a valid reg. exp.?

^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$

I tested it here http://www.pagecolumn.com/tool/regtest.htm but got "No match" for phone number. I propose to discuss this in the neighbor forum viewforum.php?f=14

Thanks.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

santhoshsamala
Posts: 26
Joined: 23 Feb 2012, 18:10

10 Apr 2012, 22:39

Thankyou oleg,

I have changed to

Code: Select all

^([\(]{1}[0-9]{3}[\)]{1}[\.| |\-]{0,1}|^[0-9]{3}[\.|\-| ]?)?[0-9]{3}(\.|\-| )?[0-9]{4}$
even this doesnt work . It works here http://www.pagecolumn.com/tool/regtest.htm

anyways thanks for the previous suggestion, I will move to primefaces extensions
Using primefaces3.2, jboss7.0.2, weld 1.1.5

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

11 Apr 2012, 08:54

Moved to extensions forum.

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests