Application Name: Platform
Version Number: 1.11.6
Modules: uicommons 1.9-SNAPSHOT
Other: registration.json to add a custom widget
I have created a widget called textareanew. Am creating a fingerprint widget by mimicking existing widgets. I have added the same to the .json file in the registration page.
Question: What should my controller have for this to work?
These fields don’t seem to need a controller (as in all these widgets not residing right under /fragments). I have successfully designed and used such a custom field when I set up our registration app back in the days. But there are two differences to your case:
It was recording an obs, and not a person attribute.
I have not created a new module as per this post. Could you possibly share some tips on how to create a new widget, more so with the ui-commons module?
Hopefully this will help you pinpoint some differences that would be causing the trouble.
As as I said, this custom fragment records an obs (and not a person attribute) and is brought in through another module than UI Commons. However at first glance I don’t see why either would make a difference.
As @mksd says, you don’t need a controller. (Also, you don’t need to touch the htmlwidgets module for this – it’s only used by the reporting module in its legacy ui admin screens.)
What you describe seems like it should work. Dumb question: did you actually build the forked uicommons module and install it in your application? And if you’re using “development mode” is it pointing to the right place?
As a last resort, you can run things under the debugger, and put a breakpoint a bit before org.openmrs.ui.framework.fragment.FragmentFactory.processThisFragment(FragmentFactory.java:184) and trace the code to see what’s happening…
As @ssmusoke says, I think it’s bad practice to fork a module, you’re better off writing your own module, or add the feature directly to an existing module without forking it
@smuwanga, your point 2. above suggests that you are indeed forking UI Commons since you are modifying it.
Making the change shown in your screenshot is not enough. As @darius hinted, you still need to build this module and install the built .omod file on your OpenMRS instance.
But as @wyclif suggested, you should do all the above as part of a custom module that brings in the new functionality that you are working on.
Thanks people. I managed to build a module, created a fragment as at Using UI Framework. The fragment works pretty well. I have placed applet tags, but gsp doesn’t render the applet as it was in jsp and html.
<script>
var attributes = {
name:'fingerApplet',
codebase:'/openmrs',
code:'org.openmrs.module.fingerprint.applet.PatientEnrollmentApplet.class',
archive:'finger_print_applet.jar',
width:600, height:300} ;
var parameters = {patientId:16} ;
var version = '1.6' ;
deployJava.runApplet(attributes, parameters, version);
</script>
Am looking for ways to save the fingerprint template on clicking “Confirm” button on the registration page. Started working person attributes + complex datatypes now.
Here is what the registration page looks like after deploying the applet.