Including custom Javascript using ui.includeJavascript method

Hello,

I’m working on an OpenMRS module using the uiframework and would like to include some custom javascript file on my gsp page. Doing a google search and looking at other modules, it seems that all I have to do is call <% ui.includeJavascript(providerName, file). But my page does not include the js file and on inspecting the generated html file the file is not imported. Are there any steps that I might have missed?

PS: I can access the javascript file from the browser using: localhost:80/openmrs/ms/uiframework/resource/module/scripts/note.js

Are you using the standard page decorator from appui? Or are you defining the whole < html > tag yourself? If the latter you need to do ${ ui.resourceLinks } like is done here.

Meta: By the way, you posted this under QA which is for Quality Assurance, not Questions and Answers, as I assume you were looking. I moved it. Next time, for Q&A, you might consider posting to https://talk.openmrs.org/c/ask

1 Like