# Forms generating invalid HTML

**URL:** <https://community.open-emr.org/t/forms-generating-invalid-html/5780>\
**Category:** OpenEMR Development\
**Created:** [January 13, 2012, 3:21am UTC](https://community.open-emr.org/t/forms-generating-invalid-html/5780 "2012-01-13T03:21:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [January 13, 2012, 3:21am UTC](https://community.open-emr.org/t/forms-generating-invalid-html/5780/1 "2012-01-13T03:21:30Z")

</div>

**[sunsetsystems](https://sourceforge.net/u/sunsetsystems/)** wrote on [Friday, January 13, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/5521dc63/#0d8b):

Noticed this when working on the Vitals form.&nbsp; Open up Vitals or any other&nbsp; encounter form, then (using Firefox) right click in the form and select This Frame -\> View Frame Source.&nbsp; 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.&nbsp; Two sets of HTML/HEAD/BODY tags, and Javascript following the last /BODY tag.

Where did this come from???

Rod  
[www.sunsetsystems.com](http://www.sunsetsystems.com)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [January 13, 2012, 3:54am UTC](https://community.open-emr.org/t/forms-generating-invalid-html/5780/2 "2012-01-13T03:54:02Z")

</div>

**[yehster](https://sourceforge.net/u/yehster/)** wrote on [Friday, January 13, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/5521dc63/#b9d8):

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](mailto:kevin.y@integralemr.com)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [January 13, 2012, 4:36am UTC](https://community.open-emr.org/t/forms-generating-invalid-html/5780/3 "2012-01-13T04:36:28Z")

</div>

**[sunsetsystems](https://sourceforge.net/u/sunsetsystems/)** wrote on [Friday, January 13, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/5521dc63/#fd70):

Hmm, it’s not that way in 3.2.&nbsp; 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](http://www.sunsetsystems.com)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [January 13, 2012, 4:52am UTC](https://community.open-emr.org/t/forms-generating-invalid-html/5780/4 "2012-01-13T04:52:25Z")

</div>

**[sunsetsystems](https://sourceforge.net/u/sunsetsystems/)** wrote on [Friday, January 13, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/5521dc63/#4f0b):

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](http://www.sunsetsystems.com)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [January 13, 2012, 10:51am UTC](https://community.open-emr.org/t/forms-generating-invalid-html/5780/5 "2012-01-13T10:51:55Z")

</div>

**[bradymiller](https://sourceforge.net/u/bradymiller/)** wrote on [Friday, January 13, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/5521dc63/#b2c2):

Some good memories there. That commit brought in some really nice features:  
[http://github.com/openemr/openemr/commit/8815623c97751debc3b131cc0a266b19f5cdd2aa](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

> **[OpenEMR](https://www.open-emr.org/)**
>
> The world's leading open-source electronic medical record and practice management software.
