Skip to main content
Inspiring
Nov 30, 2020 10:56 AM UTC
Answered

Adding @ symbol in front of a number

I have a form field in which a 4-digit number is entered, and:

1.  Upon exiting the field would like the @ symbol to appear at the beginning of the 4-digit number:  Type "1234" and diplay "@1234"

2.  If the form field is blank (not used) then the @ symbol does not appear.

This topic is closed to new replies. Start a new post to keep the conversation going.
Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
Dec 7, 2020 8:32 AM UTC

How are you changing numbers in field?

It will give you duplicate if when changing number manually you change only number and not @ .

As sugested by @JR Boulay  move script to custom format script.

 

8 replies

Les FiestAuthor
Inspiring
Dec 7, 2020 4:39 AM UTC

When I enter:

event.value = event.value != "" ? "@"+event.value : "";

It works perfect, but each time I modify a number in the field it adds an additional @ symbol to the beginning (i.e. @1234, @@2345, @@@3456, etc.).  Other than deleting the displayed @ sybmol in the field each time I change the number, is there a way to stop extra @ symbols from repeating?

Translate
Bernd Alheit
Community Expert
Community Expert
Dec 7, 2020 7:46 AM UTC

Where does you use the script?

Translate
Nikolaos.
Inspiring
Nov 30, 2020 11:13 AM UTC

I'm not the brightest in Adobe, but I can remember that you can format it with a text field.

Steps for Adobe Pro DC

Prepare form,

go to text field,

Right mouse click,

Choose properties,

Options,

Enter standard value,

insert the character "@",

Conclude.

 

So it should appear every time you click on the field.

I am sure that there are more suggested solutions, but this is easy and quick.

 

I hope I could help you.

If that's not what you want, just ignore it.

 

Thx

Nikolaos.

Translate
Nesa Nurani
Community Expert
Community Expert
Nov 30, 2020 11:04 AM UTC

Try this as validation script:

event.value = event.value != "" ? "@"+event.value : "";

Translate
JR Boulay
Community Expert
Community Expert
Nov 30, 2020 11:20 AM UTC

It would be best used as a "Format" script

😉

Translate
Acrobate du PDF, InDesigner et Photoshopographe