1 Reply Latest reply on Feb 22, 2017 7:30 PM by Joel_Geraci

    I am a novice when It comes to scripts, but I can figure it out with no problem in Acrobat XI and DC Pro but I am having a problem with it in LiveCycle.

    Andy062983 Level 1

      In my Adobe XI document I have a filed named Date.

       

      For the Date field, it has a simple calculation script to display today's date in the dd/mm/yy format (IE 22/02/17):

       

      var today = new Date();

      event.value = util.printd("dd/mm/yy", today);

       

      Then I have a custom format script to take the value from the calculation script and format it to display as 22ND DAY OF FEBRUARY, 2017

       

      if (event.value) {
          var d = util.scand("dd/mm/yy", event.value);
          if (d!=null) {
              event.value = getCustomDateString(d);
          }
      }

      function getCustomDateString(d) {
          var ordinalSuffix;
          if (d.getDate()==1 || d.getDate()==21 || d.getDate()==31)
              ordinalSuffix = "st";
          else if (d.getDate()==2 || d.getDate()==22)
              ordinalSuffix = "nd";
          else if (d.getDate()==3)
              ordinalSuffix = "rd";
          else
              ordinalSuffix = "th";

          return util.printd("D'"+ordinalSuffix+" DAY OF' MMMM, YYYY", d, true);
      }

      event.value = event.value.toUpperCase();

       

      I imported this PDF file into LiveCycle Designer ES4 and I get a notice that the Java from the document has been commented out...

       

      How would I get the above field that works in Adobe XI Pro to do the same thing in LiveCycle? We want to try our documents in LiveCycle because of the ability to make the documents dynamic and flowable.

       

      Any help would be greatly appreciated.

       

      I have a couple more instance where this is happening but I figured this was the easiest one a veteran would be able to help me with.

       

      Thanks!

        • 1. Re: I am a novice when It comes to scripts, but I can figure it out with no problem in Acrobat XI and DC Pro but I am having a problem with it in LiveCycle.
          Joel_Geraci Adobe Community Professional

          The object model for a LiveCycle form (XFA) is completely different from an AcroForm (traditional PDF). You can still use many of the same methods but the way you access the form objects will be different. So it can be done but... do you really want to?

           

          LiveCycle forms are, as you noticed, dynamic and flowable... except on mobile viewers... where they don't work at all. Not even a little.

           

          Adobe does have some server based solutions that make very good use of XFA forms but if you have not or don't plan to leverage that technology, I'd strongly advise against investing your time and energy into XFA forms. The core AcroForm technology and the AcroForm JavaScript API have been virtually unchanged since version 6 though there have been some additions and security fixes. It's incredibly stable, consistent, and reliable, and the mobile viewers and non-Adobe viewers are getting better and better at handling the code in them. AcroForms is becoming more widely adopted and supported. The future of XFA is uncertain.