Need help with SimpleUi skip logic (htmlForm.simpleUi.showField()) - Reference Application v2.1

3 views
Skip to first unread message

Craig A.

unread,
Nov 17, 2014, 1:12:52 AM11/17/14
to implem...@openmrs.org

Hi Everyone

I'm creating our encounter forms with the HTML Form Entry module in OpenMRS v2.1 standalone. I'm using Google Chrome and can't get the following skip logic to work. The second field "Mother Tongue Other" dispalys all the time. The original suggestion was made here.The value (5622) is "OTHER NON-CODED" in the concept dictionary.

<section id="survivor_background" sectionTag="section" headerStyle="title" headerLabel="Survivor's Background">
        <fieldset>
            <!--Mother Tongue-->
<legend><lookup expression="fn.getConcept('162638').name"/></legend>

            <p class="left">
<h3><lookup expression="fn.getConcept('162638').name"/></h3>
       <obs id="mother-tongue" conceptId="162638" >
<controls>
<when value="5622"
thenJavaScript="htmlForm.simpleUi.showField('mother-tongue-other')"
elseJavaScript="htmlForm.simpleUi.hideField('mother-tongue-other')"/>
</controls>
</obs>
</p>
<!--Mother Tongue Other-->
<!--Display the "other mother tongue" question if other is selected in the question-->
<p id="mother-tongue-other" class="left">
<h3><lookup expression="fn.getConcept('162650').name"/></h3>
<obs conceptId="162650"/>
</p>
        </fieldset>

    </section>

Thank you for taking a look at this!

Sincerely,
Craig

Darius Jazayeri

unread,
Nov 17, 2014, 1:44:45 PM11/17/14
to implementers
Hi Craig,

By the way, I have recently tried to document some of the Simple Form UI functionality here, and just added a section about having it work with HTML Form Entry.

At a glance your code seems correct to me. Can you open the JavaScript console and see if there are any error messages being reported there when you try this? We are using exactly this functionality on a PIH form here (please don't judge the hackiness elsewhere in the form): https://github.com/PIH/openmrs-module-mirebalais/blob/master/omod/src/main/webapp/resources/htmlforms/deathCertificate.xml#L500

Actually, come to think of it, I'm not sure if the last released version of the htmlformentryui module actually has those functions available. You might need to try getting the latest snapshot from our maven repo.

-Darius

--
OpenMRS Implementers: http://om.rs/implist
Post: implem...@openmrs.org | Unsubscribe: implementers...@openmrs.org
Manage your OpenMRS subscriptions at http://om.rs/id
 
Register today for our Maputo 2015 Implementers Meeting: http://om.rs/moz15

To unsubscribe from this group and stop receiving emails from it, send an email to implementers...@openmrs.org.

Craig A.

unread,
Nov 18, 2014, 12:43:12 AM11/18/14
to implem...@openmrs.org
Hi Darius,

Thanks for your help. I'm getting 404 errors on angular.js libraries that reference UICommons:


This happens in the vitals form as well. 

I visited the maven repo, but I have no idea how to turn the 1.2 snapshot folders into a .omod file. Are there instructions somewhere that I can follow? I'm a complete novice at development.

Thank you!
Craig

Darius Jazayeri

unread,
Nov 18, 2014, 1:26:38 AM11/18/14
to implementers
Hi Craig,

You can ignore the 404 errors on *.min.js.map.

I couldn't find any documentation on how to get the latest snapshot build of a module, so I wrote it up here: https://wiki.openmrs.org/questions/79659906/how-do-i-install-the-latest-snapshot-version-of-a-module.

However I peeked at the history of the htmlformentryui module, and I don't think this is the issue.

I'm afraid you might have to do something like inspect elements in the browser to see if anything (e.g. a CSS class) is actually changing on the should-be-hidden element when you change the other one. Or use the JavaScript debugger...

Also, make sure you're using the latest release of the HTML Form Entry module (the docs say that thenJavascript/elseJavascript are added in 2.4).

-Darius

Craig A.

unread,
Nov 18, 2014, 6:27:23 AM11/18/14
to implem...@openmrs.org
Hi Darius,

Hi Darius,

I was able to find the solution today. The problem had to do with the <h3> tags instead of using <label>. <h3> tags are used all over the vitals form, but they break the functionality when you place them nested within the <p> attribute. It seems that the htmlForm.simpleUi.showField('') function is specifically looking for the <p id=""><label></label><obs.../></p> structure. 

Sincerely,
Craig

On Tue, Nov 18, 2014 at 12:11 PM, Darius Jazayeri <> wrote:
Hi Craig,

You can ignore the 404 errors on *.min.js.map.

I couldn't find any documentation on how to get the latest snapshot build of a module, so I wrote it up here: https://wiki.openmrs.org/questions/79659906/how-do-i-install-the-latest-snapshot-version-of-a-module.

However I peeked at the history of the htmlformentryui module, and I don't think this is the issue.

I'm afraid you might have to do something like inspect elements in the browser to see if anything (e.g. a CSS class) is actually changing on the should-be-hidden element when you change the other one. Or use the JavaScript debugger...

Also, make sure you're using the latest release of the HTML Form Entry module (the docs say that thenJavascript/elseJavascript are added in 2.4).

-Darius
On Mon, Nov 17, 2014 at 9:42 PM, Craig A. <> wrote:
Hi Darius,

Thanks for your help. I'm getting 404 errors on angular.js libraries that reference UICommons:


This happens in the vitals form as well. 

I visited the maven repo, but I have no idea how to turn the 1.2 snapshot folders into a .omod file. Are there instructions somewhere that I can follow? I'm a complete novice at development.

Thank you!
Craig

On Tue, Nov 18, 2014 at 12:29 AM, Darius Jazayeri <> wrote:
Hi Craig,

By the way, I have recently tried to document some of the Simple Form UI functionality here, and just added a section about having it work with HTML Form Entry.

At a glance your code seems correct to me. Can you open the JavaScript console and see if there are any error messages being reported there when you try this? We are using exactly this functionality on a PIH form here (please don't judge the hackiness elsewhere in the form): https://github.com/PIH/openmrs-module-mirebalais/blob/master/omod/src/main/webapp/resources/htmlforms/deathCertificate.xml#L500

Actually, come to think of it, I'm not sure if the last released version of the htmlformentryui module actually has those functions available. You might need to try getting the latest snapshot from our maven repo.

-Darius

Manage your OpenMRS subscriptions at http://om.rs/id
 
Register today for our Maputo 2015 Implementers Meeting: http://om.rs/moz15

To unsubscribe from this group and stop receiving emails from it, send an email to implementers+unsubscribe@openmrs.org.

-- 
OpenMRS Implementers: http://om.rs/implist

Manage your OpenMRS subscriptions at http://om.rs/id
 
Register today for our Maputo 2015 Implementers Meeting: http://om.rs/moz15

-- 
OpenMRS Implementers: http://om.rs/implist

Manage your OpenMRS subscriptions at http://om.rs/id
 
Register today for our Maputo 2015 Implementers Meeting: http://om.rs/moz15

To unsubscribe from this group and stop receiving emails from it, send an email to implementers+unsubscribe@openmrs.org.

-- 
OpenMRS Implementers: http://om.rs/implist

Manage your OpenMRS subscriptions at http://om.rs/id
 
Register today for our Maputo 2015 Implementers Meeting: http://om.rs/moz15

On Tuesday, November 18, 2014 12:11:38 PM UTC+5:45, Darius Jazayeri wrote:
Hi Craig,

You can ignore the 404 errors on *.min.js.map.

I couldn't find any documentation on how to get the latest snapshot build of a module, so I wrote it up here: https://wiki.openmrs.org/questions/79659906/how-do-i-install-the-latest-snapshot-version-of-a-module.

However I peeked at the history of the htmlformentryui module, and I don't think this is the issue.

I'm afraid you might have to do something like inspect elements in the browser to see if anything (e.g. a CSS class) is actually changing on the should-be-hidden element when you change the other one. Or use the JavaScript debugger...

Also, make sure you're using the latest release of the HTML Form Entry module (the docs say that thenJavascript/elseJavascript are added in 2.4).

-Darius
On Mon, Nov 17, 2014 at 9:42 PM, Craig A. <> wrote:
Hi Darius,

Thanks for your help. I'm getting 404 errors on angular.js libraries that reference UICommons:


This happens in the vitals form as well. 

I visited the maven repo, but I have no idea how to turn the 1.2 snapshot folders into a .omod file. Are there instructions somewhere that I can follow? I'm a complete novice at development.

Thank you!
Craig

On Tue, Nov 18, 2014 at 12:29 AM, Darius Jazayeri <> wrote:
Hi Craig,

By the way, I have recently tried to document some of the Simple Form UI functionality here, and just added a section about having it work with HTML Form Entry.

At a glance your code seems correct to me. Can you open the JavaScript console and see if there are any error messages being reported there when you try this? We are using exactly this functionality on a PIH form here (please don't judge the hackiness elsewhere in the form): https://github.com/PIH/openmrs-module-mirebalais/blob/master/omod/src/main/webapp/resources/htmlforms/deathCertificate.xml#L500

Actually, come to think of it, I'm not sure if the last released version of the htmlformentryui module actually has those functions available. You might need to try getting the latest snapshot from our maven repo.

-Darius

Darius Jazayeri

unread,
Nov 18, 2014, 10:17:48 AM11/18/14
to implementers
Hi Craig,

Sorry, I didn't think to look for that issue in your code snippet.

<h3> (or any other block-level element) is not allowed inside a <p>. It took me hours to figure that out the first time I discovered it.


-Darius

Craig A.

unread,
Nov 23, 2014, 11:18:35 PM11/23/14
to implem...@openmrs.org
Hi Everyone,

Darius and I added this information to the Simple Form UI Wiki page to close the loop.

Sincerely,
Craig


On Tuesday, November 18, 2014 9:02:48 PM UTC+5:45, Darius Jazayeri wrote:
Hi Craig,

Hi Darius,

To unsubscribe from this group and stop receiving emails from it, send an email to implementers...@openmrs.org.

-- 
OpenMRS Implementers: http://om.rs/implist
Post: implem...@openmrs.org | Unsubscribe: implementers+unsubscribe@openmrs.org
Manage your OpenMRS subscriptions at http://om.rs/id
 
Register today for our Maputo 2015 Implementers Meeting: http://om.rs/moz15

-- 
OpenMRS Implementers: http://om.rs/implist
Post: implem...@openmrs.org | Unsubscribe: implementers+unsubscribe@openmrs.org
Manage your OpenMRS subscriptions at http://om.rs/id
 
Register today for our Maputo 2015 Implementers Meeting: http://om.rs/moz15

To unsubscribe from this group and stop receiving emails from it, send an email to implementers...@openmrs.org.

Reply all
Reply to author
Forward
0 new messages