Linking from a Fragment to a section within SimpleFormUi

0 views
Skip to first unread message

Craig A.

unread,
Mar 17, 2015, 11:06:57 AM3/17/15
to d...@openmrs.org
Hi Everyone,

I'm building a fragment that generates a link to edit an HTMLForm using the SimpleFormUi. Now, I would like to place the user at a specific question within a specific section of the HTMLForm. What's the best way to do this? Do you have any question ideas of the JavaScript functions to call to setfocus on the right question? Should I try to pass a section or question ID parameter in the URL?

Here's the link to the form from my fragment.gsp page:

<a class="visit-link" href="${ ui.pageLink("htmlformentryui", "htmlform/editHtmlFormWithSimpleUi", [ patientId: patient.patient.id, encounterId: StaffObservations.id, returnUrl: ui.thisUrl() ]) }">${ ui.message("SurvivorMIS.personalInformation.StaffObservations.label") }</a>

Here's the fieldset in the HTMLForm that I want to link to:

<!--Family Contact-->
<fieldset>
<legend>Family Contact</legend>
<p class="left">
<label><lookup expression="fn.getConcept('SurvivorMIS:162963').description"/></label>
<obs id="family-contact" conceptId="SurvivorMIS:162963" answerConceptIds="CIEL:1065,CIEL:1066,SurvivorMIS:162585,SurvivorMIS:162588">
<controls>
<when value="1065"
thenJavaScript="htmlForm.simpleUi.showQuestion('family-contact-communication-type')"
elseJavaScript="htmlForm.simpleUi.hideQuestion('family-contact-communication-type')"/>
</controls>
</obs>
</p>
</fieldset>


Sincerely,
Craig

Darius Jazayeri

unread,
Mar 17, 2015, 11:35:57 AM3/17/15
to dev
Hi Craig,

I think this is possible but we don't have a specific function for it yet.

You can find the section/question/field via this: https://issues.openmrs.org/browse/UICM-50 (Navigator should have getSections(), getQuestions(), and getFields().

Then you have to do the following silly hacky thing:
field.parentQuestion.parentSection.click();
field.parentQuestion.click();
field.click();

Let me know if it works.

-Darius

--
OpenMRS Developers: http://om.rs/dev
Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
Manage your OpenMRS subscriptions: http://om.rs/id
 
Visit OpenMRS Talk at http://om.rs/talk for chat and discussions!

Reply all
Reply to author
Forward
0 new messages