I'm trying to integrate a 3rd party JS library into a maestro form, and the library requires me to create a function attached to the browser's window global variable.

I've tried to attach the function using the page's Page Load rule (and I've confirmed that the function is attached with a subsequent console.log), however when I preview the form in Maestro, the function is not present on window any more.

Is there a way to set global properties on window and have them persist?



    CommentAdd your comment...

    1 answer


      Hi Sean,

      Try rendering the form.  Preview mode isn't exactly the same as a full render.

      Did you load your JavaScript library using the JavaScript Library component?

      1. Sean Colyer

        Hi Bill,

        The render worked and the function is available now. Thanks for the tip. I did load my library using the JS Library component. Is this the best way of loading external libraries?

      2. Unknown User (bfrost)

        Good that you got it working.

        There's a few choices of how to load libraries, and the best one is really up to the individual use case.  Check out Loading External Javascript Libraries for the different methods available.

      3. Sean Colyer

        I've run into another problem now where avoka form I am using is caching JavaScript that I have put on a Page Load event.

        I've tried loading the rendered form in Chrome (incognito mode and normal) with the Disable Cache flag set.

        I've also tried clearing the cache using the Clear Cache and hard reload option, as well as the option within the application tab of the developer tools to clear all site data.

      4. Unknown User (bfrost)

        Hi Sean,

        Try going into TM and deleting the form there, then build and render again:

      5. Sean Colyer

        Hi Bill,

        I'm just previewing the form and modifying it in Maestro. It hasn't been deployed via Transact Manager. Is this an issue?

      6. Unknown User (bfrost)

        Hi Sean,

        It should not be an issue if you're only previewing.  I routinely delete forms from TM while I'm in frequent edit/test cycles just to be sure no server-side caching is occuring.

        You can also try the tips at Deep clearing of Chrome browser cache

        If that doesn't clear the problem, maybe it's not a caching problem after all.

      7. Sean Colyer

        Thanks Bill, It looks like the 'all time' setting has resolved it. It's pretty weird that all of the other settings didn't manage to clear the cache. Can I recommend that you look at fingerprinting your JavaScript assets in a future version of Maestro - this will result in a lot less end user confusion and frustration. For example: https://www.npmjs.com/package/fingerprinting

      8. Sean Colyer

        Hi Unknown User (bfrost) - the problem has returned and resetting the cache doesn't resolve it this time - making me think that something else is happening here...

        I'm trying to test the form using the Build and Render Form option.

      CommentAdd your comment...