3 Replies Latest reply on Mar 23, 2011 10:24 AM by gkaiseril

    Custom Date for Birthdate entry


      I got issued a project that requires me to take a pre-exsisting professional Scholarship form and make it into a PDF. I've been able to make the form fields with no problem but I'm running into a few issues with the Date format.  This form requires the Applicant to type out their Birthdate and Social Security #, however, the higher ups don't like the default method Acrobat uses.


      Problem #1: Because some of our Applicants are Elderly and/or are not very computer literate, I want there to be "some" flexibility to them typing out their birthdate.  IE, MDDYY, MMDDYY, MDDYYYY, MMDDYYYY will Validate through a script that turns it into the company standard format of MM/DD/YYYY.  I have a very basic bit of Custom Keystroke script that I found and edited slightly.  Its not pretty though.

      var a = event.value;
      if(a.length==5){var b = util.scand("mddyy",a);event.value = util.printd("mm/dd/yyyy",b)}
      if(a.length==6){var b = util.scand("mmddyy",a);event.value = util.printd("mm/dd/yyyy",b)}
      if(a.length==7){var b = util.scand("mddyyyy",a);event.value = util.printd("mm/dd/yyyy",b)}
      if(a.length==8){var b = util.scand("mmddyyyy",a);event.value = util.printd("mm/dd/yyyy",b)};

      This does what I want it to do, sort of, but deviating outside of this script results in undesired results. IE typing 02/13/71 will get 02/13/71 not 02/13/1971.  Then there's a potential problem of the century. Typing 021327 will get 02/13/2027 not 1927.

      Can anyone lead me in the right direction of where to close the flexibilty off at giving an Audio Alert when any other keystroke besides 0-9 and / is entered while maintaning the Validity of the above format of MM/DD/YYYY?

      (I realize this is pretty much nitpicking, but the higher ups say jump and I have to say How High and I'm not at the skill level yet to achieve the desired results.)


      Problem #2: In the same form, the Applicants SSN needs to be entered but the default format under Properties > Format > Special is requiring the full 9 digits. However, we have more than a few people who have "less" than 9 digits.  Given that the higher ups want to give some flexibilty to Elderly and non-computer literate on the SSN field as well, I've been asked to correct this problem.  Now, I've been steered in the direction of Leading Zeros script and AutoTab features, but to be honest, most of this is beyond my understanding in how to achive it. I understand the concept of leading 0's in the util.printd feature of the 999-99-9999 format, however, any attempt to do this stuff leads in undesired results.  Please help if you can.


      Thanks in Advance,


        • 1. Re: Custom Date for Birth Date entry
          gkaiseril MVP & Adobe Community Professional

          Your birth date field script should be for a custom format and not a key stroke. The custom format is used by Acrobat to format currency and percentages but still keeping the value of the field free of the special formatting characters. You might consider using the RegExp for developing the scripts for custom keystrokes and formats. There is an issue with the birth date with a free hand  input as mmddyyyy could be confused with ddmmyyyy for some moths and dates. You will also need to validate the dates. It might be easier to enter the month, date and year as individual fields and make a hidden field with full date.


          Social Security numbers by definition can not have less nor more then 9 digits, even if it is a TIN issued by the IRS in lieu of the SSN. But if some use a poorly designed form and make the SSN field a number, leading zeros could be lost, but that does not mean that that SSN has less then 9 digits. The SSA may use other claim numbers that have more than 9 digits and could include alphabetical numbers, but these are not SSN's but a claim number.


          The util.printd method is for dates and only dates. Have you looked at the util.printf method? It is for other alphanumeric formats.

          • 2. Re: Custom Date for Birth Date entry
            Dpeterson-ufcw Level 1

            Thank you for replying Gkaiseril, not really sure what you're talking about with RegExp, hidden Fields and the like.  As I stated above, my skills with acrobat are limited and my knowledge of Java script is less than that.  Could you give examples or write out examples of what you're talking about?  I plan to learn more on Java, scripting and getting better at Acrobat, but for the mean time, I just need the scripting of how to get the Date field to do what I want it to do.


            As for the SSN, I'm aware of the 9 digit limit, this is why I'm wanting the script to fill in less-than-9-digit SSN's with leading Zeros.  We have had examples of the past of our clients and applicants with Exm 001-34-5678 not entering their 0's first and it confuses them as why their paperwork was'nt accepted or returned invalid.  Plus, our OCR system doesn't like the SSN field if its entered incorrectly.  This is why I was directed to look at leading 0's and something about a decimal point ...


            I haven't looked into the util.printd yet, in fact I know absolutely nothing about it except from what you told me.  No idea where to look for the things I want to accomplish.

            • 3. Re: Custom Date for Birth Date entry
              gkaiseril MVP & Adobe Community Professional

              Access the SSN field as a string and not a number. Acrobat stores the SSN value as a number and not a string but only displays the formatted string. Accessing values as string will show leading zeros but accessing the value as a value will suppress the leading zeros.


              You could also use the Arbitrary mask, "999-99-9999", and force the value to a string.