These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Need a textfield to show a text string IF its filled in

Rajkurt
Registered: May 19 2010
Posts: 47

Wondering if its possible to make three letters appear in a textfield (which has been set to a Number format), but only if its filled in?

Its a field where the user could enter a price, I want the field to automatticly fill in (SEK "Swedish crowns") if a value is entred.

Is it possible or is it another way to do it?

Many thanks,

/Rajkurt

My Product Information:
Acrobat Standard 8.0, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You will get an error if you try to add letters to a Number field. You can set it to have no formatting, and then write a custom formatting script that will add "SEK" at the beginning of it.
Alternatively, you can add another field with "SEK" in it and display it when the other field is not empty.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Rajkurt
Registered: May 19 2010
Posts: 47
Oh, hello again try67! Thanks for the help last time!
Yes, I have looked in to it a bit more, i have almost figured it out, as you know you can choose the "currency symbol" option, and then choose "kr" (for swedish crowns), but it has to say "SEK". So is there a way to manipulate the "currency symbol" option / or make a custom script and put in "SEK"?

Thanks for the fast answer!
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You can't manipulate the currency symbol, but you can create your own script that does something similar.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Rajkurt
Registered: May 19 2010
Posts: 47
I have googled after a custom format script, but hasnt been able to find one. You dont have a link to one of thoose scripts? All I need is to see the structure of the script, and then I think I can solve it on my own.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Basically it's pretty simple. Try something like this as the format script:

event.value = "SEK " + event.value;

You might want to consider adding another script that clears the field when the user enters it, or you might end up with multiple "SEK " elements.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Rajkurt
Registered: May 19 2010
Posts: 47
It works perfectly! But then it takes away my decimal places and seperator styles, is it possible to ad that to the code aswell?

I found this here on the forum, will, but i couldnt get it to work:
--
Try the following as a custom format script:

this.getField(event.target.name).setAction("Format", 'AFNumber_Format(2, 0, 0, 0, "$", false)');


The Acrobat proviced forms function call:

AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend)

nDec = number of decimals
sepStyle = separator style 0 = 1,234.56 / 1 = 1234.56 / 2 = 1.234,56 / 3 = 1234,56 /
negStyle = 0 black minus / 1 red minus / 2 parens black / 3 parens red /
currStyle = reserved
strCurrency = string of currency to display
bCurrencyPrepend = true = pre pend / false = post pend
Rajkurt
Registered: May 19 2010
Posts: 47
I got it to work! This is the right code:

AFNumber_Format(2, 0, 0, 0, " SEK", false)

Thanks for all the help!