Thousand separator does not work in p:inputnumber when I change the locale of the page.

UI Components for JSF
Post Reply
yunusemmre
Posts: 4
Joined: 19 May 2022, 11:54

19 May 2022, 12:12

Hello,

Code: Select all

<p:inputNumber id="employee-number" styleClass="employee-number"
                                               value="#{newLogbookEntry.employeeNumber}" required="true"
                                               thousandSeparator="." padControl="false"/>
My inputnumber element is as above. Independent of locale, I want my thousand separator to be a dot. My page's locale is German as default. In this case, the thousand separator works. But when I click on the link that translates the language of the page to English, the thousand separator does not work, I guess because it changes to locale. I will be very happy if you reply as soon as possible.

jepsar
Posts: 166
Joined: 03 Sep 2014, 11:41
Location: NL / BE
Contact:

21 May 2022, 11:49

PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub: https://github.com/jepsar
Spotify: 90s Rave, Acid, Trance, House

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

21 May 2022, 18:03

Yes please provide a reproducer and let us know which version of PF. Nothing I can see for InputNumber looks at the locale currently.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

yunusemmre
Posts: 4
Joined: 19 May 2022, 11:54

25 May 2022, 14:52

Hello. I saw your replies late as I did not receive the mail. Thanks for your answers. I downloaded the primefaces-test project and created a page for you to understand the problem. If you click the sidebar button and then the link to change the language, you will see that the thousands separator does not work on the English page and you can type letter in the inputNumber on the English page. Also, the values in the other input fields are retained after the language is changed. But after typing a value in inputNumber on the English page, this value is not preserved if switching to the German page.

(I use Primefaces 11)

https://github.com/avyunusemre/primefac ... Number.git

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

25 May 2022, 17:34

Thanks for the reproducer. Found your problem. Press F12 and look at console errors.

"autoNumeric will not function properly when the decimal character 'decimalCharacter' [.] and the thousand separator 'digitGroupSeparator' [.] are the same character."

You can fix it by adding "decimalSeparator"

Code: Select all

thousandSeparator="." decimalSeparator=","
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

yunusemmre
Posts: 4
Joined: 19 May 2022, 11:54

27 May 2022, 10:41

Thanks for your answer. I thought it was a more complex problem since I didn't get an error message in Idee's console :)

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

29 May 2022, 13:53

No problem. Happy to help!
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 46 guests