HTML DOM Elements in LBF Nation Notes Fields

@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.

Thanks,
ViSolve

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 :slight_smile: ). Leading me to believe it has something to do with locale.

@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

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 ). 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

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

-brady

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.

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

@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

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?

-brady

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.

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.

Iā€™ve looked at this before. If you want I can take another look.

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

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

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.

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.

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!

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.

@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.

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.

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 ā€¦