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

Add '/' between 7-figure entered value...

Engaged ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

Hi all,

 

Am looking for a way to add a "/" symbol between a value entered in to a text field ("text1"). The limit of characters is 7, and the "/" symbol should go after the first 3 figures, and again after the 5th figure, e.g. a user enters "19843T54", and ideally after should be "198/43/T54".

 

Possible with script?.

 

TOPICS
PDF forms

Views

1.0K

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 , Jun 15, 2021 Jun 15, 2021

Under the field's Properties dialog, in the Format tab, select Special, then Arbitrary Mask and enter the following:

XXX/XX/XXX

Votes

Translate

Translate
Community Expert ,
Jun 14, 2021 Jun 14, 2021

Copy link to clipboard

Copied

You said char limit is 7 and in your example you have 8 char "19843T54",

There is multiple ways to achive it, you can try use this as "Custom format script" of "text1" field:

var str = event.value.slice(0,3)+"/"+event.value.slice(3,5)+"/"+event.value.slice(5,8);
if(event.value)
event.value = str;

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 ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

What should happen when the user enters "198/43/T54" ?

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 ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

Under the field's Properties dialog, in the Format tab, select Special, then Arbitrary Mask and enter the following:

XXX/XX/XXX

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 ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

That won't work if he set character limit.

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
Engaged ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

Hi all,

 

Many thanks for the replies, and both Nesa's and Try67 answers both worked absolutely perfectly (despite the fact I obviously cannot count!). In the end, Try67's answer worked best for me, but both were great solutions to my original post...and of course Bernd's note is equally true, but I will remember to not mis-type seeing as it's me that will be filling it in ;-).

 

Thnaks all! 

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 ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

The character limit is not needed if you use an arbitrary mask. It limits the number of characters the user can enter automatically.

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
Engaged ,
Jun 15, 2021 Jun 15, 2021

Copy link to clipboard

Copied

LATEST

Thanks Try67, a great solution 😉

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