Skip to main content
Inspiring
November 30, 2020
Answered

Adding @ symbol in front of a number

  • November 30, 2020
  • 3 replies
  • 1518 views

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 has been closed for replies.
Correct answer Nesa Nurani

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.

 

3 replies

Les FiestAuthor
Inspiring
December 7, 2020

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?

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
December 7, 2020

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.

 

Nikolaos.
Inspiring
November 30, 2020

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.

Nesa Nurani
Community Expert
Community Expert
November 30, 2020

Try this as validation script:

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

JR Boulay
Community Expert
Community Expert
November 30, 2020

It would be best used as a "Format" script

😉

Acrobate du PDF, InDesigner et Photoshopographe