javascript - Including Moment.js in LiveCycle Designer -


For some days I am trying to include the actual Moment.JS Library in my dynamic PDF with which I created Adobe's Livecycle Designer

We used an old version (1.7.2) without any problems, but now I get the only 'function not present' error.

Anyone

How to include Moment.js is an Adobe In the Live Cakes form:

  1. Download the minifed script
  2. Open your form in the LiveCycle Designer and create a script object called MOMENTJSMIN
  3. Copy the Mainframe Scripts that script object
  4. In the LiveCycle Designer's Script Editor window, the MOMENTJSMIN scripts execute the object as follows Filing in:
  5. Remove up to the script, but the second curly brace {:

     ! Function (A, B) {"Object" == Type of Export & amp; "Undefined"! = Typef module? Module.expo rts = b (): "function" == typef define & amp; Define.amd? Define (b): a.moment = b ()} (this, function ()  
  6. Remove spherical brackets and semicolons from the end of the mined script

  7. Add this line to the beginning of the mined script:

      if (xfa.momentjs == undefined) xfa.momentjs = function ()  
  8. Add this function to the script after the end of the MOMENTJSMIN script object:

      function getMomentJS () {return xfa.momentjs () );}  

Now your MOMENTJSMIN script object Your form is set to provide Moment.js for the script.

To use the moment, in any of your scripts, start your script object or event script with this script :

  var moment = MOMENTJSMIN.getMomentJS ();  

Now you can use () anywhere in the script that starts with that line Example:

var moment = MOMENTJSMIN.getMomentJS (); Var jan07 = moment ([2007, 0, 29]); App Alert (moment (.) Format ("DDDD, MMMM YYYY, H: MM: SS A")); App.alert (jan07.format ("dddd, MMMM Do YYYY") + "was" + jan07.fromNow ()); App.alert (moment.isDate (new date ()));

Comments