• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

leading zeroes

Explorer ,
Jul 19, 2024 Jul 19, 2024

Copy link to clipboard

Copied

I have text field in which I will input numbers I need something to add leading zeroes to numbers (6)
if I enter 1, field should show 000001 if I enter 1234 field should show 001234 can you help?

TOPICS
How to

Views

171

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 19, 2024 Jul 19, 2024

You can use this as custom format script:
if(event.value)
event.value = util.printf("%06d", event.value);

Votes

Translate

Translate
Community Expert ,
Jul 19, 2024 Jul 19, 2024

Copy link to clipboard

Copied

You can use this as custom format script:
if(event.value)
event.value = util.printf("%06d", event.value);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 19, 2024 Jul 19, 2024

Copy link to clipboard

Copied

Just be aware the above code will not change the actual field value, only the way it is displayed.
If you export or copy it, it will still be without those zeros.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 19, 2024 Jul 19, 2024

Copy link to clipboard

Copied

LATEST

Thanks, @try67, I do need to keep original value and show zeroes just for display.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines