OpenMRS HTML form viewing

@mogoodrich @dkayiwa @surangak @burke

I need to know how to edit the view method of OpenMRS HTML forms. Since I am embedding a third party library in order to get the functionality for JsPedigrees(pedigree drawing tool) when it comes to viewing saved OpenMRS forms I need to load a saved XML value to the jspedigrees method setStateXML() in order to draw the pedigree. How can I edit this in order to load the XML related to the pedigree?

Edit : The third party library is not loaded in the patient dashboard page where vitals are shown( I categorized the HTML form as a vital) . Is there a reason for this? if I can fix this I am sure it would solve the issue.

@mogoodrich @dkayiwa @surangak @burke

Hi, This is a blocker. I would like to have some pointers to tackle this. :slight_smile:

Did you read this? https://wiki.openmrs.org/display/docs/HTML+Form+Entry+JavaScript+Reference#HTMLFormEntryJavaScriptReference-Definingjavascriptfunctionstocallbeforeformvalidationandsubmission

The before submission callback should allow you to save the XML with an Ajax call, apparently.

@lluismf : Thank you for the reply, I think I can work on this, there is one major issue. That is OpenMRS HTML form viewing.

My java script reference library in the form is not loaded in the viewing mode. Is there a option for that as well?

Have you tried importing the JS library in the form source? It seems the logical place to do it, unless the HTML forms engine does not recognize it (in this case, you will need to hack the engine).

This is the git hub project.

in the read me file I have stated how I have added the resources. below is the line I used to call the java script library

Am I doing something wrong?

“Hack the engine?” you mean internally or externally? :open_mouth:

Are you sure these resources are loaded? You can use the browser dev tools to check it (the Debugger has a list of the JS loaded).

“Hack the engine”: if it’s a bug (or a missing feature) of the HTML Forms module you can fix it and do a pull request.

Nope. I checked those are not loaded on the viewing page. :confused: Possible bug it is.

Do you know where should I edit to “hack the engine”?

@lluismf : javascripts load in the editing page :slight_smile: :slight_smile: not in the viewing mode. I tried it under vitals as well as an encounter. Result was the same. :frowning:

If I were you, I’d study the HTML Forms module to see how the rendering is done (JSP, custom tag etc.) to understand better the problem.

@lluismf Sure I will do so, this points to another question, the reference application has .gsp files (not .jsp as the older GUI ). Should I still do the same manner you suggested?

Please read https://wiki.openmrs.org/display/docs/HTML+Form+Entry+Module+Technical+Overview

Without diagrams it’s a bit hard to understand how it works, maybe better to read the code instead.