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?.
Under the field's Properties dialog, in the Format tab, select Special, then Arbitrary Mask and enter the following:
XXX/XX/XXX
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;
Copy link to clipboard
Copied
What should happen when the user enters "198/43/T54" ?
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
Copy link to clipboard
Copied
That won't work if he set character limit.
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!
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.
Copy link to clipboard
Copied
Thanks Try67, a great solution 😉