<p:inputMask> Question / Suggestion

UI Components for JSF
Post Reply
burferd
Posts: 234
Joined: 01 May 2010, 16:15

22 Nov 2011, 17:15

I'm trying to figure out a way to use the inputMask to handle a money field.
I need to be able to handle a variable number of digits followed by a decimal and 2 more digits - like 9999.99

My question is how can I make the number of digits in front of the decimal variable, so the user can enter 9.99 or 99999.99
I know you can make trailing values optional by using the question mark, is there a way to make leading values optional?
Maybe something like 000009.99 where the leading values are optional, but must be digits?

Thanks.
Using PrimeFaces 3.4, Mojarra 2.1.6, Glassfish 3.1.2, NetBerans 7.2, Hibernate 3.2.5 (sometimes)
Windows 7.

SpecialAgent
Posts: 24
Joined: 03 Dec 2009, 22:00

29 Dec 2011, 16:31

I have the same question. Would be nice if someone can answer this.

Thank you
JBoss AS 7.1.1
PrimeFaces 3.3.1
PrimeFaces-Extension 0.5.1
PrimeFaces-Mobile 0.9.3
Mojarra 2.1.7-jbossorg-1 (20120227-1401)

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

30 Dec 2011, 01:48

I believe p:inputMask is using jQuery, so I searched google for jquery input mask currency, and wanted to suggest that you see the following which should help you out.

jQuery plugin for formatting inputs

Above URL references this: Masked Input Plugin

If you find an answer to your question, then please reply with your solutions, so it will be here for community for later reference.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

mpalitang
Posts: 7
Joined: 30 Mar 2012, 00:00

07 Sep 2012, 23:53

I am having this same issue. I would like to be able to enter 9.99 or 999.99 for a dollar amount. I found that using "?999.99" as the Mask value, will allow both combinations. However, when the user types 9.99, the value is 999 in the input box. How can I force the typing of the decimal to jump to the decimal spot so that the user won't have to enter 009.99 (as most internet users won't type this).

dilipagarwal
Posts: 3
Joined: 04 Apr 2014, 16:55

01 May 2014, 11:04

Same [quote="mpalitang"] mpalitang[I am having this same issue. I would like to be able to enter 9.99 or 999.99 for a dollar amount. I found that using "?999.99" as the Mask value, will allow both combinations. However, when the user types 9.99, the value is 999 in the input box. How can I force the typing of the decimal to jump to the decimal spot so that the user won't have to enter 009.99 (as most internet users won't type this).]

Same Issueeee.... Any suggestion please :cry:

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

01 May 2014, 11:06

i always use pe:inputNumber for money fields.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 63 guests