콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
5330 화면

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
5397
1
8월 20
4755
2
7월 19
4278
1
11월 22
4300
2
8월 25
3599