JS/jquery in HTML Form Entry Module is loaded to late !?

2 views
Skip to first unread message

Artur Neumann

unread,
Oct 2, 2012, 4:24:42 AM10/2/12
to d...@openmrs.org
I'm trying to run some JS in the module I'm developing (Converting Nepali to Gregorian Dates) and I managed to get my JS file into OpenMRS with the
org.openmrs.headerFullIncludeExt
extension point defined in /openmrs-core/webapp/src/main/webapp/WEB-INF/template/headerFull.jsp

My JS file is always loaded in the <head> tag. And in most of the pages jQuery and other JS files are loaded before. That how I expected it and how I need it to be.

But when I start the HTML Form Entry Module (creating or executing a form)
/openmrs/dwr/engine.js
/openmrs/dwr/interface/DWRAlertService.js
and my file is loaded in the <head> tag but the rest, including jQuery (seems to be an own version of  the  HTML Form Entry Module) later in the <body> tag.

I suppose this has to do with:
<c:if test="${empty DO_NOT_INCLUDE_JQUERY}">

So what is the advised way to deal with it? Should I bring an own version of jQuery for my module? That seems to be odd, if we already have at least two versions in the system. Or do I have to change DO_NOT_INCLUDE_JQUERY? Would that bring the Form Entry Module into trouble?
An advice for an OpenMRS beginner would be very appreciated.

Darius Jazayeri

unread,
Oct 2, 2012, 3:25:29 PM10/2/12
to d...@openmrs.org
Hi Arthur,

I don't really know how to work around this...

The issue is that in order to work against different core versions of OpenMRS, the HTML Form Entry module loads its own jquery library (and tells core not to load one). The problem is that this jquery doesn't get loaded in the head tag (and can't as far as I know).

The only solution I can think of would be to decide to stop supporting OpenMRS < 1.7 in the HTML Form Entry module, and just count on the core version of jquery and jquery UI. I can see us deciding to do that, but that's not going to be a snap decision. If you want this to happen, please create a ticket at tickets.openmrs.org in the HTML project asking for it, and include a link to the email thread.

The quickest workaround for you is probably to check out the code for the HTML Form Entry module, and remove both the DO_NOT_INCLUDE_JQUERY and the actual inclusion of jquery and jquery-ui that's done in htmlformentry.jsp, and then do a custom build for yourself. Then let us know if that works!

-Darius

--
OpenMRS Developers: http://go.openmrs.org/dev
Post: d...@openmrs.org
Unsubscribe: dev+uns...@openmrs.org
*** OpenMRS has moved from Subversion to Git. Read more: http://go.openmrs.org/git ***
 
 

Ben Wolfe

unread,
Oct 2, 2012, 3:42:32 PM10/2/12
to d...@openmrs.org
Can HTMLFormEntry just do a version check instead of using that property?  (or in addition to)

Ben

Jeremy Keiper

unread,
Oct 4, 2012, 3:49:22 PM10/4/12
to d...@openmrs.org
Is there an extension point in the footer?

Jeremy Keiper
OpenMRS Core Developer
AMPATH / IU-Kenya Support

Burke Mamlin

unread,
Oct 4, 2012, 5:17:52 PM10/4/12
to d...@openmrs.org
Mykola added an extension in the footer for his in-page translation module during GSoC.

-Burke

Darius Jazayeri

unread,
Oct 4, 2012, 6:01:48 PM10/4/12
to d...@openmrs.org
We could definitely look at doing that in HTML Form Entry. I don't have the code accessible at the moment, but maybe we can look into it next week.

-Darius
Reply all
Reply to author
Forward
0 new messages