For few days I've been trying to include the actual Moment.js library in my dynamic PDF which I've created with Adobe Livecycle Designer.
We've used an older version (1.7.2) without any problems but now I only get a 'Function not exist' error.
Does anyone have any expierience with this?
Thanks in advance.
How to include Moment.js in an Adobe LiveCycle Form:
Remove all the script up to but not including the second curly brace { :
!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function()
Remove the rounded parenthesis and semicolon from the end of the minified script
Add this line to the beginning of the minified script:
if (xfa.momentjs == undefined) xfa.momentjs = function()
In the MOMENTJSMIN Script Object add this function after the end of the script:
function getMomentJS(){ return xfa.momentjs(); }
Now your MOMENTJSMIN script object is set up to provide Moment.js to scripts throughout your form.
To use Moment.js in any of your script, start your script object or event script with this line:
var moment = MOMENTJSMIN.getMomentJS();
Now you can use moment() anywhere in the script that starts with that line. eg:
var moment = MOMENTJSMIN.getMomentJS();
var jan07 = moment([2007, 0, 29]);
app.alert(moment().format("dddd, MMMM Do YYYY, h:mm:ss a"));
app.alert(jan07.format("dddd, MMMM Do YYYY") + " was " + jan07.fromNow());
app.alert(moment.isDate(new Date()));
What I would check first:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.