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

KNOW HOW: JavaScript 4 special Commands and Characters in a MessageBox

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Answered

Hi Community,

messages in a MessageBox has to be often very simple, because the text cannot be formatted alot.
But there are just some JavaScript-codes which allow text formatting or adding special characters.
Basic codes are [b]\r[/b] or [b]\n[/b] for line breaks, everybody knows that.
Some of you also may know [b]\t[/b] can be used to add a tab stop.

There are many more codes, most of them usable for special characters such a copyright sign, registered sign or arrows and lines.

See this example form for more details:
https://share.acrobat.com/adc/document.do?docid=02f0fec8-f0bf-4ba7-a891-cf340c8515cb

:-)

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

My Product Information:
LiveCycle Designer, Windows
PetafromOz
Registered: Jun 8 2009
Posts: 230
Hey this is great. So glad you shared this with us. I used it today in LiveCycle to do this:

xfa.host.messageBox("This 'h' value field can only:\r \7 be left empty, \r \7 have a value of 0, or \r \7 have an 'h' range value of between " + HazMin.rawValue + " and " + HazMax.rawValue + " (incl.). \r Please re-enter.","Incorrect Hazard ('h') factor",3);

It makes the message box look so much more professional.

Thanks Radzmar

from way... underground at Parkes - central West NSW - Australia

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You can also use unicode to encode data like:
xfa.host.messageBox( "\u0048\u0065\u006C\u006C\u006F World!")
[url=www.joelonsoftware.com/articles/Unicode.php]Unicode and Character Sets[/url]

The above will work in FormCalc and JavaScript.

George Kaiser