Skip to main content
Participant
August 27, 2018
Answered

How do I set a form field to accept leading zeros in a number?

  • August 27, 2018
  • 2 replies
  • 24931 views

I am trying to create a fillable form using Acrobat Pro DC 2018 for Mac. One of the fields asks for the employee number. Some begin with zero, but after entering the number and saving the form, the leading zero doesn't show up.

    Correct answer Bernd Alheit

    Set the format to None.

    2 replies

    Participant
    August 27, 2018

    Thanks ever so much!!! That worked.

    Bernd Alheit
    Community Expert
    Bernd AlheitCommunity ExpertCorrect answer
    Community Expert
    August 27, 2018

    Set the format to None.

    Participant
    January 24, 2020

    Sir,

    Setting the format to None, the field will also accept alphabets, and then it is not an 'only number' field. The leading zero has to be displayed in Number field alone. In some of the very earlier versions of Excel, it was easy to choose Number format to 'display' or 'do not display' leading zeros.

    R G Kulkarni

    try67
    Community Expert
    Community Expert
    January 24, 2020

    PDF and Excel are very different things. If you want the field to only accept numbers, but still allow initial zeros, use the following code as its custom Keystroke script (under Properties - Format - Custom):

     

    if (event.change) event.rc = /^\d+$/.test(event.change);

     

    Note that using this code you won't be able to enter the negative symbol, or a comma, etc. Only digits.