Skip navigation
Currently Being Moderated

Form Field Label

Apr 30, 2012 2:09 PM

I'm not sure if the is the right place to post my question I've posted it under forms <> with no success hoping that someone might be able to help me here:


I have the same question as this thread <> plus a little bit extra.


So the answer (which has worked out wonderfully) was submitted by George:


// Custom format script for text field

if (!event.value) {

    event.value =; = display.noPrint;

} else { = display.visible;



But as George eluded in his first post in the thread was:

The problem with this approach is it precludes easily using any of the built-in formats that you may want to use (Number, ZIP code, etc.). You still can, but it requires more scripting.


So how can I get the combination of the Form Field Lable being displayed and also the auto formatting for Phone numbers, Zip Codes etc.?


Any help is greatly appreciated.


I'm running Acrobat X Pro on Windows if that matters.


Message was edited by: chad Snelson

Updated question:

So I was thinking about it some more and remembered seeing this line of code:

event.value = util.printx("99-9999999", event.value); From <>.


And then the Arbitrary Mask formatting option

< bd615109794195ff-7de4.w.html>

and it appears that the tax id line of code uses those same guide lines.   So is there away to use George's section of code and combine it with the tax id line of code and just use the Arbitrary Mask formatting rules so if one text field was for a zip use George's section and just change the tax id line so instead of all the nines it would just have 99999 ? If this makes any sense or is possible if someone could please reply with an example I'd greatly appreciate it!


So I was playing around with combining both soultions and just added the Tax ID formatting to George's part and came up with this:


// Custom format script for text field

if (!event.value) {

    event.value =; = display.noPrint;

} else { = display.visible;

    event.value = util.printx("99-9999999", event.value)



So that works great if you put in a total of nine numeric characters but if you input letters then it still lets you it just doesn't show them verses the arbitrary mask formatting option where it doesn't even let you put in letters and requires the right about of numeric characters.


So my new question/problem is how to only allow numeric characters to be entered and require the right ammount of characters with the above code?

  • Currently Being Moderated
    Apr 30, 2012 3:08 PM   in reply to chad Snelson

    If you can find a copy of the Version 5 Acrobat JS API. There is reference to some internal JS functions for keystrokes, and format.













    You can list the code in the JS console by removiing the "()" and see the parameters needed to call the funciton.



    function AFSpecial_Format(psf) {
        var value = event.value;
        if (!value) {
        switch (psf) {
          case 0:
            var formatStr = "99999";
          case 1:
            var formatStr = "99999-9999";
          case 2:
            var NumbersStr = util.printx("9999999999", value);
            if (NumbersStr.length >= 10) {
                var formatStr = "(999) 999-9999";
            } else {
                var formatStr = "999-9999";
          case 3:
            var formatStr = "999-99-9999";
        event.value = util.printx(formatStr, value);

    Mark as:
  • Currently Being Moderated
    Apr 30, 2012 3:17 PM   in reply to chad Snelson

    You might try the custom calculation script.


    Have you considered what to do if the data is removed?

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points