跳至內容
選單
此問題已被標幟
1 回覆
5376 瀏覽次數

Hello,

I have a float fields like this:

abc = fields.Float()

In the UI,  I want to set the float fields so that when the user is inputting the specific number, a thousand separator (,) should be added automatically in realtime to the number once it increments by 3 figures.....thousand, million, billion, etc... and when erased to below 4 figures the number goes back to normal.

Of course, when I click the save button, it will follow the thousands separator format that I set up in Translations -> Language -> English (US)


Please help!

Thank you!

頭像
捨棄
作者 最佳答案

Finally, I resolved my wish. Just create a widget with the function of auto populate commas or dots when the user enters values into the float field. The code look like this:

            var input = this.$el.html();

            var output = input.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".")

And it works fine after click a button!

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
4
9月 18
5457
1
8月 20
4814
2
7月 19
4295
1
11月 22
4375
0
10月 25
110