Search code examples
javascriptjquerylotus-domino

Including and referring to jQuery as a file in an iNotes-form in Domino Designer


We are trying to use jQuery in Domino Designer. When I create a library, post the code of jQuery in the editor and try to save, Domino designer complains about compile errors, which turns out to be a reported bug!

Our clients are using old versions of Domino and we can't expect such a bug to be fixed on their machiens. Anyway, there seems to be some solutions.

In my case, I have to go for adding jQuery as a file. The problem is that the old application we are modifying is forms-based. In XPages, one could refer to the lib like this:

<xp:script src="/jquery-1.4.2.min.js" clientSide="true"></xp:script>

Where the js-library would reside in the resources/files folder in the iNotes application.

However, in a form, I can only refer to libraries included explicitly in the libraries folder. Is there a way to include the js-file, whose path is reachable, in a form?


Solution

  • Using jQuery in forms is as almost easy as in XPages: Just go to the HTML- header- section of the form and do exactly the same, but with a "script"- Tag:

    Here is the formula I used for jquery, jquery,cookie and jquery-ui:

    "<script type=\"text/javascript\" src=\"/" + @WebDbName + 
        "/jquery.js\"></script>" +
    "<script type=\"text/javascript\" src=\"/" + @WebDbName + 
        "/jquery.cookie.js\"></script>" +
    "<script type=\"text/javascript\" src=\"/" + @WebDbName + 
        "/jquery-ui.js\"></script>"
    

    Usually It should work without the @WebDbName as well, but I found out, that there might be conditions (e.g. Form embedded in a frameset in another app) where this is not safe.