Forms generating invalid HTML

sunsetsystems wrote on Friday, January 13, 2012:

Noticed this when working on the Vitals form.  Open up Vitals or any other  encounter form, then (using Firefox) right click in the form and select This Frame -> View Frame Source.  You see stuff like this (… represents omitted lines):

<html>
<head>
<link rel="stylesheet" href="/openemr/interface/themes/style_oemr.css" type="text/css">
<script language="JavaScript">
function openNewForm(sel) {
...
</script>
</head>
<body class="bgcolor2">
...
</body>
</html>
<html>
<head>
...
</head>
<body bgcolor="#dddddd">
...
</body>
<script language="javascript">
var formdate = '20120112';
...
</script>
</html>

Grossly improper.  Two sets of HTML/HEAD/BODY tags, and Javascript following the last /BODY tag.

Where did this come from???

Rod
www.sunsetsystems.com

yehster wrote on Friday, January 13, 2012:

Rod,
I traced through the code to investigate and this is what I’ve found.
All of the forms, first include interface\patient_file\encounter\new_form.php which has it’s own <html> <head> and <body> elements
Which is brought in by load_form.php in the same directory.
Then when the form specific code is processed, the template file (general_new.html) also gets loaded in which has it’s own <html> <head> and <body>

For example, for vitals, this file gets pulled in when C_FormVitals.class.php gets loaded
\interface\forms\vitals\templates\vitals\general_new.html

From a survey of the code history, I think the invalid HTML has been there for a long time.
-Kevin Yeh
kevin.y@integralemr.com

sunsetsystems wrote on Friday, January 13, 2012:

Hmm, it’s not that way in 3.2.  It seems wrong for HTML to be generated prior to the template, and it appears 3.2 does not do that.

Rod
www.sunsetsystems.com

sunsetsystems wrote on Friday, January 13, 2012:

Looks like interface/patient_file/encounter/load_form.php was modified to include new_form.php by a commit on 2011-02-22 entitled “New Sliding Menu Module and Support for User Specific Globals:”.

Rod
www.sunsetsystems.com

bradymiller wrote on Friday, January 13, 2012:

Some good memories there. That commit brought in some really nice features:
http://github.com/openemr/openemr/commit/8815623c97751debc3b131cc0a266b19f5cdd2aa

Guessing change was related to the interface/patient_file/encounter/new_form.php code bringing in the snazzy Encounter Summary menu.

-brady