Single/disconnected obs.datetimes in HTML Form Entry

1 view
Skip to first unread message

Steven Githens

unread,
May 30, 2012, 5:19:09 PM5/30/12
to d...@openmrs.org
Hello OpenMRS Dev,

Is there an existing way to disconnect the obs.datetime date widget that
appears when you use <obs showDate='true' />, for either single or
multiple instances?

For instance, in the multiple case I have:

<td><obs conceptId="7423" showDate="true" answerConceptId="1115"
answerLabel="Normal"/>
<obs conceptId="7423" showDate="true" answerConceptId="7417"
answerLabel="ASCUS"/>
<obs conceptId="7423" showDate="true" answerConceptId="7418"
answerLabel="AGUS"/>
<obs conceptId="7423" showDate="true" answerConceptId="7419"
answerLabel="LSIL"/>
<obs conceptId="7423" showDate="true" answerConceptId="7420"
answerLabel="HSIL"/>
</td>

I want to have a single date widget somewhere on the page, that will
populate all of these, in both the situation where I'm allowing you to
check more than one of them, or just one.

Do we have a baked in way to do this yet?

If not, my first instinct is to use CSS selector to hide the date widget
inside all of the spans those <obs/> tags create, then paint my own date
widget with some javascript, and just have it update all their hidden
ones whenever it changes.

Thoughts?

Cheers,
Steve

Darius Jazayeri

unread,
May 30, 2012, 5:29:07 PM5/30/12
to d...@openmrs.org
As far as I know, your suggestion is the only way...

-Darius

-- OpenMRS Developers: http://go.openmrs.org/dev
Post: d...@openmrs.org
Unsubscribe: dev+uns...@openmrs.org

Mark Goodrich

unread,
May 30, 2012, 5:45:41 PM5/30/12
to d...@openmrs.org

As far as I know as well…

Steven Githens

unread,
Jun 15, 2012, 3:09:30 PM6/15/12
to d...@openmrs.org
I created a bug to eventually have a server side fix for this. [1]

But for the immediate time came up with this javascript: https://github.com/sgithens/openmrs-forms/blob/master/obsdatetime.js

So essentially you put another date widget on the page with an ID, and give everything else ID's as well.

During the init, it checks for any error messages (in case you just submitted an invalid form), and if those exist copies the span.error dom tag after the new date widget.  Then it checks for any existing date submissions (in case you're ediding an existing encounter), and populates the new disconnected date widget.

Then it sets up event observers to sync all the obs.datetime widgets with the disconnected one whenever a combo box is checked, or you change the new date widget. Also deleting the date in the obs.datetime widget if you uncheck the checkbox.

-s


[1] https://tickets.openmrs.org/browse/HTML-359
Reply all
Reply to author
Forward
0 new messages