# HTML DOM Elements in LBF Nation Notes Fields

**URL:** <https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035>\
**Category:** OpenEMR Development\
**Created:** [September 20, 2017, 8:53am UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035 "2017-09-20T08:53:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![visolveemr](https://community.open-emr.org/user_avatar/community.open-emr.org/visolveemr/32/10974_2.png) [@visolveemr](https://community.open-emr.org/u/visolveemr)\
**Post date:** [September 20, 2017, 8:53am UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/1 "2017-09-20T08:53:23Z")

</div>

@brady.miller

We found that there is a bug in Nation Notes fields of LBF Forms.

While editing the forms with nation notes fields , the nation note field is just displaying HTML DOM elements instead of displaying raw data .

1.Create a LBF form with nation notes field .

2.Create an encounter and put the newly created LBF form

3.Open the LBF form and create any HTML elements like table , list , etc in nation field

4.Fill the form and click save from both nation notes and encounter form screen

5.Reopen the form with edit mode from encounter summary screen

It will display HTML DOM elements in the form field.

Screen shot attached for your reference.

 ![html_elements_in_lbf_form](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/2/26267a0b2b21fe208ee3e197bf6812bf3f5590a7.png)

Thanks,  
[ViSolve](http://www.visolve.com/hc/)

---

<div class="post-metadata">

**Author:** ![sjpadgett](https://community.open-emr.org/user_avatar/community.open-emr.org/sjpadgett/32/21623_2.png) [@sjpadgett](https://community.open-emr.org/u/sjpadgett)\
**Post date:** [September 20, 2017, 1:45pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/2 "2017-09-20T13:45:49Z")

</div>

I’ve seen and scratched my head over this before. Seems it only occurs on one ARNP’s laptop (told her it was personal! Turns out, some folks don’t appreciate my sense of humor 🙂 ). Leading me to believe it has something to do with locale.

---

<div class="post-metadata">

**Author:** ![visolveemr](https://community.open-emr.org/user_avatar/community.open-emr.org/visolveemr/32/10974_2.png) [@visolveemr](https://community.open-emr.org/u/visolveemr)\
**Post date:** [September 28, 2017, 8:47am UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/3 "2017-09-28T08:47:11Z")

</div>

@brady.miller,

Can you please check whether the nation note field editing is a bug or not in OpenEMR 5 ?  
We can able to reproduce the issue in our local .  
Kindly check this and share your views.

Thanks,  
[ViSolve](http://www.visolve.com/hc)

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [September 28, 2017, 9:58am UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/4 "2017-09-28T09:58:44Z")

</div>

Hi @visolveemr ,

Don’t have time to test this now (rec testing it out on the online demo (admin:pass credentials; website/wiki is down so here"s the link: [http://one.openemr.io/openemr/interface/login/login.php?site=default](http://one.openemr.io/openemr/interface/login/login.php?site=default) ). As I recall @juggernautsei had this issue also and was related to html escaping of the code. See here for a strategy to deal with this in another work in progress by @juggernautsei :  
[Sherwin’s bootstrap dictation form and added WYSIWYG editor by bradymiller · Pull Request #893 · openemr/openemr · GitHub](https://github.com/openemr/openemr/pull/893/files#diff-35b5f64d37771db5592ef670441f0b15)

(note that HTMLPurifier class is already included in the current codebase, so could see if this fixes your issue)

-brady

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [September 28, 2017, 10:02am UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/5 "2017-09-28T10:02:04Z")

</div>

Also, a screenshot of step 3 would be helpful. since as I recall there should be editor stuff(ie. buttons etc.) showing up. And, if so, then there should editor stuff showing up in the edit screen.

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [September 28, 2017, 10:06am UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/6 "2017-09-28T10:06:00Z")

</div>

Looks like website/wiki just came back online (again…), so here’s the link to the development demo:  
[http://www.open-emr.org/wiki/index.php/Development\_Demo#Daily\_Build\_Development\_Demos](http://www.open-emr.org/wiki/index.php/Development_Demo#Daily_Build_Development_Demos)

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [September 29, 2017, 8:26am UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/7 "2017-09-29T08:26:18Z")

</div>

@visolveemr , (no need to send me the screenshot requested above). Confirmed this bug on 5.0.0 with most recent patch.

btw, I was not even able to test this in the most recent development codebase since there is a bug in the new  
Administration-Lists gui that appears to not show empty lists in the selector (@robert.down).

-brady

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [September 29, 2017, 8:55am UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/8 "2017-09-29T08:55:41Z")

</div>

Regarding the bug of not being able to create layout based forms in main codebase, this is not related to @robert.down gui refactoring of the List editor (which is really nice by the way). This is actually a new feature by @sunsetsystems whereby, the creation of layout based forms/transactions are now created in Administration-\>Layouts. So, that issue has been put to rest.

Above being said, the Nation Notes now does not work at all in the Layout Based Notes in the development codebade. All I see is a vertical bar when try to edit the form that can not be clicked on (usually click on it and the a editor popup happens). Below screenshot shows the vertical bar for the Nation Notes field(note the field to the right of it is a textarea field). @sunsetsystems , any thoughts on this?

 ![image](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/b6e1bd012bc6a329e22a23c6b6b672cd642e5516.png)

-brady

---

<div class="post-metadata">

**Author:** ![sunsetsystems](https://community.open-emr.org/user_avatar/community.open-emr.org/sunsetsystems/32/11906_2.png) [@sunsetsystems](https://community.open-emr.org/u/sunsetsystems)\
**Post date:** [September 29, 2017, 1:17pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/9 "2017-09-29T13:17:00Z")

</div>

Hi Brady, I haven’t used Nation Notes much but I tried not to break it. Will take a look and see if I did.

---

<div class="post-metadata">

**Author:** ![sunsetsystems](https://community.open-emr.org/user_avatar/community.open-emr.org/sunsetsystems/32/11906_2.png) [@sunsetsystems](https://community.open-emr.org/u/sunsetsystems)\
**Post date:** [September 29, 2017, 3:52pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/10 "2017-09-29T15:52:30Z")

</div>

I’m finding that clicking exactly on the vertical bar on my (not quite current) test site does open the pop-up. The textarea to the right as well as its containing div are initially created with style=‘display:none’ and so you cannot click on that. I have no idea what’s going on there or what’s supposed to un-hide it.

After getting the popup I am able to see the problem reported by Visolve. Am not immediately seeing what would cause it.

---

<div class="post-metadata">

**Author:** ![sjpadgett](https://community.open-emr.org/user_avatar/community.open-emr.org/sjpadgett/32/21623_2.png) [@sjpadgett](https://community.open-emr.org/u/sjpadgett)\
**Post date:** [September 29, 2017, 4:07pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/11 "2017-09-29T16:07:56Z")

</div>

I’ve looked at this before. If you want I can take another look.

---

<div class="post-metadata">

**Author:** ![sjpadgett](https://community.open-emr.org/user_avatar/community.open-emr.org/sjpadgett/32/21623_2.png) [@sjpadgett](https://community.open-emr.org/u/sjpadgett)\
**Post date:** [September 29, 2017, 4:13pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/12 "2017-09-29T16:13:19Z")

</div>

Also, if creating html in note one might expect to see html in edit.  
I let it be because it displays correctly.

---

<div class="post-metadata">

**Author:** ![sunsetsystems](https://community.open-emr.org/user_avatar/community.open-emr.org/sunsetsystems/32/11906_2.png) [@sunsetsystems](https://community.open-emr.org/u/sunsetsystems)\
**Post date:** [September 29, 2017, 4:17pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/13 "2017-09-29T16:17:08Z")

</div>

Sure, if you have time any additional insight would be good.

---

<div class="post-metadata">

**Author:** ![sjpadgett](https://community.open-emr.org/user_avatar/community.open-emr.org/sjpadgett/32/21623_2.png) [@sjpadgett](https://community.open-emr.org/u/sjpadgett)\
**Post date:** [September 29, 2017, 4:50pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/14 "2017-09-29T16:50:54Z")

</div>

Several things going on here but I don’t see why with generating html in the note and it appears as html in the edit field this is a problem. Where else should it be? As long as it doesn’t show as html in the editor or encounter print then I say works as expected.  
There is a styling issue and graceful exits don’t work as expected. Also, if creating LBF fails, we get a hang. Noticed too that the encounter can lose its session 'till app keep alive timer restores the session.

---

<div class="post-metadata">

**Author:** ![sunsetsystems](https://community.open-emr.org/user_avatar/community.open-emr.org/sunsetsystems/32/11906_2.png) [@sunsetsystems](https://community.open-emr.org/u/sunsetsystems)\
**Post date:** [September 29, 2017, 5:29pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/15 "2017-09-29T17:29:03Z")

</div>

I’m seeing the problem reported by visolve goes away with this change to options.inc.php:

```
1251c1251
< echo "<div id='form_{$field_id}_div' class='text-area'>".htmlspecialchars($arr[0], ENT_QUOTES)."</div>";
---
> echo "<div id='form_{$field_id}_div' class='text-area'>" . $arr[0] . "</div>";

```

That is, the htmlspecialchars() call does not belong there. Not sure if that’s the “correct” fix though.

---

<div class="post-metadata">

**Author:** ![sjpadgett](https://community.open-emr.org/user_avatar/community.open-emr.org/sjpadgett/32/21623_2.png) [@sjpadgett](https://community.open-emr.org/u/sjpadgett)\
**Post date:** [September 29, 2017, 5:34pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/16 "2017-09-29T17:34:57Z")

</div>

Still don’t get why you would want to render the html in the edit field. That’s nation notes job and edit field should show what the editor sees!

---

<div class="post-metadata">

**Author:** ![sunsetsystems](https://community.open-emr.org/user_avatar/community.open-emr.org/sunsetsystems/32/11906_2.png) [@sunsetsystems](https://community.open-emr.org/u/sunsetsystems)\
**Post date:** [September 29, 2017, 5:44pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/17 "2017-09-29T17:44:30Z")

</div>

I personally don’t care, but it’s rendered there when you first create it. Not sure what the design is intended to be but it should be consistent.

---

<div class="post-metadata">

**Author:** ![sunsetsystems](https://community.open-emr.org/user_avatar/community.open-emr.org/sunsetsystems/32/11906_2.png) [@sunsetsystems](https://community.open-emr.org/u/sunsetsystems)\
**Post date:** [September 29, 2017, 6:56pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/18 "2017-09-29T18:56:00Z")

</div>

@brady.miller Regarding the initial emptiness and non-clickability of the Nation Notes field in your test case, its table cell is very narrow because there is no cell below it to force it wider. This problem would go away if you add a field above or below it in the layout. A reasonable fix in the code might be to force a minimum width for the (non-hidden) div inside the cell.

---

<div class="post-metadata">

**Author:** ![sjpadgett](https://community.open-emr.org/user_avatar/community.open-emr.org/sjpadgett/32/21623_2.png) [@sjpadgett](https://community.open-emr.org/u/sjpadgett)\
**Post date:** [September 29, 2017, 7:21pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/19 "2017-09-29T19:21:08Z")

</div>

I guess I don’t care either. Can say it has worked this way for as long as I’ve used OpenEMR. Could also supply the anchor a title like ‘editor’ etc.  
@brady.miller Also noted that sometimes leaving edits or views in encounter form or I guess when globals is recalled, the session is gone. I think cal timer or background services timer restores the session to continue on but for a time session is poof. Sounds similar to encounter problem someone was recently having when they would go back into a form and pid and eid was missing.

---

<div class="post-metadata">

**Author:** ![sjpadgett](https://community.open-emr.org/user_avatar/community.open-emr.org/sjpadgett/32/21623_2.png) [@sjpadgett](https://community.open-emr.org/u/sjpadgett)\
**Post date:** [September 29, 2017, 9:04pm UTC](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035/20 "2017-09-29T21:04:07Z")

</div>

The styling issue is that we have a text-area inside a text class. Text-area has width but text class doesn’t so text-area is restrained. Don’t know if whomever did theme style sheet it is meant to not give a text class a width so may be best to fix inline in this case. Should I? I’m going to try to add a time picker option so …

[Next page](https://community.open-emr.org/t/html-dom-elements-in-lbf-nation-notes-fields/9035.md?page=2)
