1
0
-1

Is there a way to declare a JavaScript function or library within a Maestro form, then reference it from other objects in the form? Or do we need to write the functions in a JS file and load it as an external resource?

    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Hey Chris, there is a JavaScript Liibrary component in the palette that satisfies this requirement.

      1. Ben Warner

        Did this give you what you needed Chris?

      2. Chris Reid

        It lets us do what we need to do, I was asking more if there is a way to define these at a form level, without having to upload a library as a shared resource. I asked this question on behalf of a client, who like to define JS functions in each of their forms to handle common procedures. These would be unique to each form, so uploading them as shared resources (correct me if I'm wrong, but this seems to be how the JavaScript Library component) would be functional, but perhaps not the most elegant solution.

      3. Ben Warner

        I'm not clear on what you are saying. The JavaScript Library does not have to be a shared resource, just add it to the form you want it on...

      4. Chris Reid

        Ah, ok, I assumed that when you uploaded a library to the component it would go to a shared library. I've had a play now and I can see it on the form's resources tab, with the option to publish to another library. This is perfect, thanks Ben.

      5. Sacha Trube

        Hey Ben, Does it matter where you place a JavaScript Library component within the structure?

        Maestro won't let me add it to the "Content" level, where I assume it should go, with an error "Can't place a JavaScript Library in a Page Controller".

        Although I can add it to a page, it just doesn't seem right that it should go there.

         

      CommentAdd your comment...