Skip to main content
Participant
Aug 27, 2018 5:47 PM UTC
Answered

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

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.

    Bernd Alheit
    Bernd AlheitCorrect answer
    Community Expert
    Aug 27, 2018 7:30 PM UTC

    Set the format to None.

    24 replies

    Participant
    Aug 27, 2018 7:57 PM UTC

    Thanks ever so much!!! That worked.

    Translate
    Bernd Alheit
    Community Expert
    Bernd AlheitCommunity ExpertCorrect answer
    Community Expert
    Aug 27, 2018 7:30 PM UTC

    Set the format to None.

    Translate
    Participant
    Jan 24, 2020 5:17 AM UTC

    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

    Translate
    try67
    Community Expert
    Community Expert
    Jan 24, 2020 10:14 AM UTC

    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.

    Translate