OpenMRS 1.9.2 UI Framework, App Framework & Groovy syntax for input field referring to concept

0 views
Skip to first unread message

Timothy Tuti

unread,
Feb 28, 2013, 12:42:14 AM2/28/13
to d...@openmrs.org
I am just wondering how you can refer to to other concept types using the following command from a groovy page (.gsp) . Especially at the config syntax.

[ object: command, property: "birthWeight", label: "Weight at Birth", config: [ ??answerTo??: birthWeightConcept ] ]

The birthWeightConcept is of type numeric and class datatype

Also how would you refer to concept sets of class ConvSet  in a .gsp page when you intend to have observations in a single set answered for each patient using the similar syntax as the following?

[ object: command, property: "setItem", label: "Set Concept Item", config: [ ??answerTo??: setItemConcept] ]

What changes in the fragment controller are required?

--Tuti

Darius Jazayeri

unread,
Feb 28, 2013, 3:10:20 AM2/28/13
to dev
Hi Timothy,

I'm having trouble understanding exactly what you're asking. Could you point to a more complete code snippet?

-Darius




--Tuti

--
OpenMRS Developers: http://go.openmrs.org/dev
Post: d...@openmrs.org
Unsubscribe: dev+uns...@openmrs.org
Manage your OpenMRS subscriptions at https://id.openmrs.org/
 
 

Timothy Tuti

unread,
Feb 28, 2013, 7:44:51 AM2/28/13
to d...@openmrs.org
Here are some code snippets

http://pastebin.com/kuNnVEcx

I get  the following error messages

"Concept field currently only supports config.answerTo and config.options mode (error for formFieldName=birthWeight)"

But my concept is of type numeric and class datatype. My question is, what is the proper syntax to use to add an observation for the Weight at Birth Concept in a .gsp file?



--



Timothy Tuti,
Senior Principal Partner,
Hazelband Consulting Group
Tel : (+254)(0)736262966

www.hazelband.com

Darius Jazayeri

unread,
Feb 28, 2013, 5:45:02 PM2/28/13
to dev

Hi Tuti,

Apologies for the lack of documentation on this...

So, ultimately the rowOfFields fragment that you're using delegates to the field widget (code here). This supports passing the following things in its configuration:

1. if you pass "value" in the config, then that value is just displayed in a nicely-formatted way.

2. if you pass "class" in the config, then an entry widget is displayed for the user to enter that class.

3. if you pass "object" and "property", then an entry widget is displayed for the user to enter object.property (with the class of that property, and the initial value of its current value)

So, the "right" way to do this, given the code you've already written, is:
1. change the command.birthWeight property to be a Double
2. in newbornsetRows, remove that config--it won't do anything
3. write a java.lang.Double.gsp under webapp/fragments/field, patterned after java.lang.Integer.gsp that's there already.

You could probably do this more easily though if you just put something like <input name="birthWeight" type="number" min="0" max="10" step="0.1" value="${command.birthWeight ?: ""}"/>

-Darius

Timothy Tuti

unread,
Mar 1, 2013, 4:41:57 AM3/1/13
to d...@openmrs.org
That worked!!. It rendered the view well. That was very helpful. When I click the submit button in the view to enter values to the OpenMRS, I get the following error message:

"Failed TypeError: err.globalErrors is undefined ({})"

Would you happen to know why? I should note that the module is running as an app in KenyaEMR 2013.2 Snapshot.

--Tuti.
Reply all
Reply to author
Forward
0 new messages