11 Replies Latest reply on Aug 28, 2017 9:51 AM by jennyt59374539

    Adobe Pro DC: Extracting digits from a field and adding punctuation

    Tesgah

      Hi,

      I have a field called «ID.number» where the users fill inn a number. The number contains a birth date and five other digits and will always be in this format: "DDMMYY00000".

       

      I want to extract the birth date from the field and add it to a new field called «birth.date.» The output should be: dd.mm.yy (or dd.mm.yyyy)

      Can anyone help me with a script so I can extract the numbers and add punctuation marks between the digits? (I do not usually work with javascript)

       

      I have managed to get the first six digits in the new field, but I do not know how to add punctuation marks. Right now I only get «DDMMYY» instead of «DD.MM.YY».

      This is my current script:

      1. this.getField("birth.date").value = event.value.substr(0,1)
      2. this.getField("birth.date").value = event.value.substr(0,2)
      3. this.getField("birth.date").value = event.value.substr(0,3)
      4. this.getField("birth.date").value = event.value.substr(0,4)
      5. this.getField("birth.date").value = event.value.substr(0,5)
      6. this.getField("birth.date").value = event.value.substr(0,6)

       

      Thank you for your help.