AnsweredAssumed Answered

Question about Custom JavaScript Library permissions

Question asked by davidbeayon on Mar 25, 2015
Latest reply on Mar 25, 2015 by davidbeayon

I'm using moment.js to do some time data calculations on a form.  I have JavaScript code that functions perfectly on the Form when I, as Administrator, works perfectly.  I have the moment.js file located in mysiteinfo/sites/dc/Style%20Library/moment.js.  I also have this  location stored in the Forms Custom JavaScript incudes section.  Again, Everything works fine when I am logged in as the admin.  I have a button that triggers this function:

 

function calculateTestTime() {

    var finish= NWF$("#"+dtFinish);

    var start = NWF$("#" + dtStart);

    var dos = NWF$("#" + dtDOS);

    var recordertime = NWF$("#" + txtRecorderTime);

    var now = new moment();

    finish.val(now.format("HH:mm:ss"));

    var started = (dos.val() + " " + start.val());

    var finished= (dos.val() + " " + finish.val());

    var a=moment(started);

    var b=moment(finished);

    recordertime.val(now.diff(a, 'minutes'));

}

  However, if other users try to initiate this code by clicking the button they get a debug error that says moment is undefined. Other built in JavaScript Built in functions work just fine for all users. Let me know if you need additional information

Outcomes