Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


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

Contributor ,
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

555

Likes

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

Adobe Community Professional , 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

Likes

Translate

Translate
Adobe Community Professional ,
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;

Likes

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

Copy link to clipboard

Copied

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

Likes

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
Adobe Community Professional ,
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

Likes

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

Copy link to clipboard

Copied

That won't work if he set character limit.

Likes

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
Contributor ,
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! 

Likes

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
Adobe Community Professional ,
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.

Likes

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

Copy link to clipboard

Copied

LATEST

Thanks Try67, a great solution 😉

Likes

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