Difference between revisions of "OpenEMR Xml Form Generator"

From OpenEMR Project Wiki
 
(More than one person working on this.)
(33 intermediate revisions by the same user not shown)
Line 5: Line 5:
It contains a series of XSLT stylesheets, a Makefile, and a pile of .xml files.
It contains a series of XSLT stylesheets, a Makefile, and a pile of .xml files.


The XML files (at least the more recent ones) contain form definitions. (look at initial_contact_sheet.xml and communication_log.xml for examples)
The XML files contain example form definitions. this is a series of xml files containing forms, for you to draw from when writing your own forms.


= Dependencies =
= Dependencies =
Line 13: Line 13:


= Using =
= Using =
To 'compile' a form, run "make INFILE=filename.xml". This will create a directory with 7 .php files, and one .sql file, hopefully conforming to [[The Forms API]]. to import one of these forms, copy it to the interface/forms location in your openemr install. then go to the administration->forms page, and the form should be shown at the bottom of the page.  Register it, run its sql, enable it, and you're done!


= XML File Format =
== Compiling an Example Form ==
To 'compile' a form, open up a terminal, go to the directory you have extracted xmlformgen into, and type "make INFILE=filename.xml", where filename.xml is the name of a xml document you've created, or one of the .xml files that comes with xmlformgen. This will create a directory with 7 .php files, and one .sql file, hopefully conforming to [[The Forms API]].


== Importing a Form ==
To import one of these forms, copy the folder containing the generated files to the interface/forms location in your openemr install. Login to your OpenEMR install as the 'administrator', to the administration->forms page, and the form should be shown at the bottom of the page as a form ready-to-install.  Register it, run its sql, enable it, and you're done!


== Header ==
= Format of a XML Input File =


=== Version ===
== Comments ==
XML style comments can be applied anywhere an element would be placed. they should be formatted like the following:


<?xml version="1.0" encoding="ISO-8859-1"?>
<pre>
  <!-- MHP Progress Note -->
  <!-- this OpenEMR form has not yet been approved by CRRT -->
</pre>
 
== Required Parts of a Form ==


=== Generation information ===
=== XML Header ===
Indicates how generated and by whom
Input files should start with a header, defining the file as an XML document.


<pre>
<pre>
<!-- Generated by Hand -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Created by Rix White on 2010-01-27 -->
</pre>
</pre>


=== Open the form tag ===
=== Open the form tag ===


<form>
The form tag contains the contents of your form. there should only be one form tag per document, at the top opening the document, and a closing tag at the bottom of the file.
 
<pre>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Example form -->
<form>
<!-- Form contents go here. -->
</form>
</pre>
 
==== The Table Entity====
 
===== Content =====
This entity's contents indicate the sql-safe name of the table where the data for this form will be stored.
 
===== Attributes =====
The 'type' option indicates the table type.


=== Comments ===
* '''form''' indicates that this form happens in an encounter, and it will not have a revision history. (this is the normal behavior of forms in OpenEMR)
Comments regarding the form and its approval by the CRRT
* '''extended''' indicates that this form can fall outside of the encounter system (like the 'history' page), but it doesn't prevent it from being part of the encounter system. Mainly, it gives us a form that saves edit history. the 'history style' link for the page will show the most recent form for the given client that was 'signed' via the signatures method below.


<pre>
<pre>
  <!-- MHP Progress Note -->
<?xml version="1.0" encoding="ISO-8859-1"?>
  <!-- this OpenEMR form has not yet been approved by CRRT -->
<!-- Example form -->
<form>
<table type="form">form_example</table>
<!-- Form contents go here. -->
</form>
</pre>
</pre>


=== Table ===
==== The RealName Entity ====
This entity contains the name of the form as it will show up in OpenEMR. Single ticks should be escaped PHP style.


==== Content ====
<pre>
Indicates the sql-safe name of the table where the data for this form will be stored.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Example form -->
<form>
<table type="form">form_example</table>
<RealName>Example Form</RealName>
<!-- Form contents go here. -->
</form>
</pre>


==== Attributes ====
==== The safename Entity ====
The 'type' option indicates the table type
This entity contains the html-safe directory-name-safe name of the form. this will be the name of the directory xmlformgen creates, and populates with files, along with the name used for internal variables in the form.
* '''form''' indicates that this form happens in an encounter, and it will not have a history. (this is what formscript.pl does)
* '''extended''' indicates that this form can fall outside of the encounter system (like 'history'), but it doesn't prevent it from being part of the encounter system. Mainly, it gives us a form that saves edit history. CAVEAT: don't use the same extended form to replace history, AND as an encounter form. this requires the signature system (not yet built) to function.


<pre>
<pre>
  <table type="extended">form_mhp_progress_note</table>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Example form -->
<form>
  <table type="form">form_example</table>
<RealName>Example Form</RealName>
<safename>example</safename>
<!-- Form contents go here. -->
</form>
</pre>
</pre>


=== Names ===
==== The style Entity ====
Both of these names will show up in the `registry` table.  'RealName' will be in `registry`.`name` and 'safename' will be in `registry`.`directory`
The style entity indicates what 'style' to use when drawing the form, and the number of columns wide to make the form.  
 
===== Content =====
* layouts: visual style similar to the layout engine (non-encounter forms)
* paper: visual style is more similar to the encounter system forms style


==== RealName ====
===== Attributes =====
Indicates the name as it will show up in the GUI
* cells_per_row: indicates how many columns you want to lay out your fields in. (i.e., how many '''<nowiki><td></nowiki>s''' per '''<nowiki><tr></nowiki>''')
  <RealName>MHP Progress Note</RealName>


==== safename ====
<pre>
Indicates the html-safe name
<?xml version="1.0" encoding="ISO-8859-1"?>
  <safename>mhp_progress_note</safename>
<!-- Example form -->
<form>
<table type="form">form_example</table>
<RealName>Example Form</RealName>
<safename>example</safename>
<style cells_per_row="4">paper</style>
<!-- Form contents go here. -->
</form>
</pre>


=== Style ===
==== Notes about RealName, and safename ====
==== Content ====
Both of these names will show up in the `registry` table of the mysql database. 'RealName' will be in `registry`.`name` and 'safename' will be in `registry`.`directory`
* Layouts: similar to the layout engine
* Paper: similar to the encounter system forms style
==== Attributes ====
* cells_per_row: Indicates how to build the html table structure (i.e., how many '''<nowiki><td></nowiki>s''' per '''<nowiki><tr></nowiki>''')


  <style cells_per_row="4">layout</style>
== Optional Form Components ==


=== Acl ===
=== The Acl Entity ===
We don't know how this stuff works yet.
We don't know exactly how to configure this, but the code is templated from openemr code, and its reported to work by a user. It is not required.


==== Content ====
==== Content ====
The content of the acl entity is the name of the 'type of information' we require the user have permissions to.


==== Attributes ====
==== Attributes ====
* table:  
* table:  
<pre>
<acl table="patients">med</acl>
</pre>


  <acl table="patients">med</acl>


== Body ==
== Describing Your Form ==
=== <nowiki><Manual></nowiki> and <nowiki><Layout></nowiki> tags===
Forms generated by the XML form generator are broken into sections, which are collapsable. each of these sections contains a series of fields, laid out on a 'grid'. Structurally, this means that all of your fields MUST be contained inside of sections, and all of your sections MUST be inside of a manual or layout entity(described next).
The '''<nowiki><manual></nowiki>''' tag and the '''<nowiki><layout></nowiki>''' tag both enclose a part of the XML document that indicates sections and fields the form generator will generate. The difference between the tags is that '''layout''' will create a php page that honors the layout engine (this functionality is currently broken), whereas '''manual''' dictates specifically how the layout will look.


<manual>
=== Manual and Layout Entities ===
  ... some sections with fields ...
The '''<nowiki><manual></nowiki>''' tag and the '''<nowiki><layout></nowiki>''' tag both enclose a section of the XML document that contains sections and fields the form generator will generate. The difference between the tags is that '''layout''' will create a php page that honors the layout engine (this functionality is not commonly tested), whereas '''manual''' uses xmlformgen's internal engine to generate the form contents (and is recommended). you MUST place all your fields within sections, and all your sections inside of either a manual or a layout section.
</manual>


==== <nowiki><Section></nowiki> tag ====
 
=== Section Entities ===
The '''<nowiki><section></nowiki>''' tag begins a named, collapsible section of the form.
The '''<nowiki><section></nowiki>''' tag begins a named, collapsible section of the form.


* Content: The content of this tag consists of the fields (see next wikisection)
==== Content ====
* Attributes: The attributes that this tag requires are
The contents of this tag should consists only of field entities, as described below.
** '''name''': indicates the name used for the div in the html
** '''label''': indicates the visible name of the secton that will show up in the GUI and (I assume in the <nowiki><layout></nowiki> mode will be the name of the section that goes into the `layout_options`.`group_name` field


<section name="client_info" label="Client Info">
==== Required Attributes ====
  ... some fields ...
:* '''name''': indicates the name used for the div in the html.
</section>
:* '''label''': indicates the visible name of the secton that will show up in the GUI and (I assume in the <nowiki><layout></nowiki> mode will be the name of the section that goes into the `layout_options`.`group_name` field.


==== <nowiki><Field></nowiki> tag ====
==== Example ====
This tag is where the rubber meets the road.  It creates the fields at every level: sql table structure, html forms, etc.  It has no content, only attributes, and it closes itself thusly:
<pre>
<section name="client_info" label="Client Info">
<!--- field entities go here -->
</section>
</pre>


<field [put some attributes here] />
=== Field Entities ===
Each field on your form is represented by a field entity. a field entity describes the fields at every level: sql table structure, look, behaviors, etc. fields have no content, only attributes, and therefore can be self-closed as shown below:


===== Basic attributes =====
<pre>
* '''name''': dictates both the column name in the sql table and the name of the html form field
<field [put some attributes here] />
* '''label''': dictates the label for the html form field that will be visible in the GUI
</pre>
* '''type''': dictates the data type both for the html form field and the sql table (more on this below, as each type dictates further required and optional attributes)
* '''hoverover''': dictates the title attribute of the html form field (be careful with single quotes here, they should be escapable with a backslash, but this needs to be tested)
* '''labelcols''': dictates the html table colspan that the label will use
* '''cols''' : dictates the html table colspan that the form field will use


===== Type options and their specific attributes =====
==== Common Attributes ====
The most important attribute is the 'type' attribute. this attribute specifies the 'type' of the field (and is an abuse of xml, IMO). this dictates its display properties, behaviors, and other attributes required.


====== Text types ======
* '''type''': dictates the data type both for the html form field and the sql table. (more on this below, as each type dictates further required and optional attributes)
'''textfield''': dictates a varchar text field
 
* required extra attributes
Some other attributes are required for most fields:
* '''name''': dictates both the field's column name in the sql table and the name of the html object representing the field. The contents of this attribute need to be safe for both html field names, and mysql column table names.
* '''label''': dictates the label will be visible in the GUI. This attribute's contents must be escaped PHP style.
* '''hoverover''': dictates the title attribute of the html form field. In effect, this becomes the text that pops up when you hover your mouse over the field. It is believed that this attribute's contents must be escaped PHP style.
* '''labelcols''': dictates the number of columns that will be reserved for displaying the label in the form.
* '''cols''' : dictates the number of columns that will be reserved for displaying the field in the form.
 
==== Field Types, and Type Specific Attributes ====
 
===== textfield =====
fields with a type of 'textfield' are useful for containing a field with a hard limit on text contents.
 
====== Required Attributes ======
** '''maxlength''': dictates the varchar length of the table column where the list data will be stored
** '''maxlength''': dictates the varchar length of the table column where the list data will be stored
* optional extra attributes
** '''length''': dictates the size of the html form length - defaults to 10
      <field name="test_textfield" label="Textfield" type="textfield" hoverover="" length="50" maxlength="255" labelcols="1" cols="3"/>


'''textbox''': dictates a textbox capable of 64k of text
====== Optional Attributes ======
* no additional attributes
** '''length''': dictates the size of the html field used for input - defaults to 10 characters
      <field name="test_textbox" label="Textbox" type="textbox" hoverover="" labelcols="1" cols="3"/>
 
====== Example ======
<pre>
<field name="test_textfield" label="Textfield" type="textfield" hoverover="A Text Field" length="50" maxlength="255" labelcols="1" cols="3"/>
</pre>
 
===== TextBox =====
Fields with a type of 'textbox' are useful for containing narrative contents, EG, paragraphs of text. Textboxes are capable of containing up to 64K of text.
====== Attributes ======
TextBoxes have no attributes other than the ones required for all fields.


'''textarea''': dictates a textarea capable of 64k of text
====== Example ======
* optional extra attributes
<pre>
<field name="test_textarea" label="Textarea" type="textarea" rows="10" columns="80" labelcols="1" cols="1"/>
</pre>
 
===== The textarea Type =====
Fields with the textarea type are capable of containing 64k of text in a box.
 
====== Optional Attributes ======
** '''rows''': indicates the number of rows in the visible textarea - defaults to 4
** '''rows''': indicates the number of rows in the visible textarea - defaults to 4
** '''columns''' indicates the number of columns in the visible textarea - defaults to 40
** '''columns''' indicates the number of columns in the visible textarea - defaults to 40
      <field name="test_textarea" label="Textarea" type="textarea" rows="10" columns="80" labelcols="1" cols="1"/>


====== List types ======
<pre>
'''checkbox_list''': creates a checkbox list which allows for multiple selections to be save in a pipe-delimited format
<field name="test_textarea" label="Textarea" type="textarea" rows="10" columns="80" labelcols="1" cols="1"/>
* required extra attributes
</pre>
 
===== The checkbox_list Type =====
The checkbox_list field type creates a set of checkboxes, which allows for multiple checkboxes to be selected.
 
====== Required Attributes ======
** '''list''': this references the 'listid' of a list in a <nowiki><list></nowiki> tag (which, itself, should refrence the listid from the list_options table)
** '''list''': this references the 'listid' of a list in a <nowiki><list></nowiki> tag (which, itself, should refrence the listid from the list_options table)
      <field name="test_checkbox" label="Checkbox" type="checkbox_list" list="yesno" hoverover="" labelcols="1" cols="1"/>


'''dropdown_list''': creates a dropdown list which allows for single selections to be saved
====== Example ======
* required extra attributes
<pre>
<field name="test_checkbox" label="Checkbox" type="checkbox_list" list="yesno" hoverover="" labelcols="1" cols="1"/>
</pre>
 
===== The dropdown_list type =====
The dropdown_list field type creates a dropdown list which allows for individual selections to be saved.
 
====== Required Attributes ======
** '''list''': this references the 'listid' of a list in a <nowiki><list></nowiki> tag (which, itself, should refrence the listid from the list_options table)
** '''list''': this references the 'listid' of a list in a <nowiki><list></nowiki> tag (which, itself, should refrence the listid from the list_options table)
** '''maxlength''': dictates the varchar length of the table column where the list data will be stored
** '''maxlength''': dictates the varchar length of the table column where the list data will be stored
      <field name="test_dropdown" label="Dropdown" type="dropdown_list" list="status" maxlength="30" hoverover="" labelcols="1" cols="1"/>


====== Other types ======
====== Example ======
'''date''': indicates a datetime sql field (stripped of the time) and ensures a calendar widget next to the field in the GUI
<pre>
* no additional attributes
<field name="test_dropdown" label="Dropdown" type="dropdown_list" list="status" maxlength="30" hoverover="" labelcols="1" cols="1"/>
      <field name="test_date" label="Date" type="date" hoverover="" labelcols="1" cols="3"/>
</pre>


'''provider''': creates an int(11) field that references the "providers" from the `users` table
===== The date Type =====
* no additional attributes
Fields with a date type are meant for storing a date in. on input forms, this draws a calendar widget next to the field. This type has no additional attributes required.
      <field name="test_provider" label="Provider" type="provider" hoverover="" labelcols="1" cols="1"/>


=== List ===
<pre>
Every list type in the <nowiki><sections></nowiki> above should have a list in the <nowiki><list></nowiki> area.  Right now we're not importing lists (notice that the import attribute ="no") so there is no need to have content for these tags (which would normally be the list items) and the list tag can close itself.  Both self-closing and with-list-options are shown below.
<field name="test_date" label="Date" type="date" hoverover="" labelcols="1" cols="3"/>
</pre>


Please keep in mind, that OpenEMR's lists system has a 31 character limit for list ids and listitem ids.
===== The provider Type =====


Note: if you don't have the list created in Oemr already and/or your list id attribute isn't referencing a real list, then the field won't show up in the GUI.
'''provider''': creates an int(11) field that references the "providers" from the `users` table. The provider type has no additional attributes required.


List with options:
<pre>
<field name="test_provider" label="Provider" type="provider" hoverover="" labelcols="1" cols="1"/>
</pre>
 
=== Lists ===
Every list used in the field entities above should have a list entity representing it.  Lists can be either lists that are already in openemr (internal lists), or can be created as part of importing the form.  In cases where you're not having the form import the lists(by setting the import attribute ="no") there is no need to have content for these entities, and the list tag can close itself.
 
==== Example List ====


<pre>
<pre>
  <list name="yesno" label="Yes/No" type="standard" id="yesno" import="no">
<list name="yesno" label="Yes/No" type="standard" id="yesno" import="yes">
    <listitem id="NO" label="NO" order="1">NO</listitem>
<listitem id="NO" label="NO" order="1">NO</listitem>
    <listitem id="YES" label="YES" order="2">YES</listitem>
<listitem id="YES" label="YES" order="2">YES</listitem>
  </list>
</list>
</pre>
</pre>


List without options that closes itself:
==== Example Internal List ====
 
  <list name="marital_status" label="Marital Status" type="standard" id="marital" import="no"/>


<pre>
<list name="marital_status" label="Marital Status" type="standard" id="marital" import="no"/>
</pre>


[[User:Ytiddo|Justin Doiel]] is probably working on this as you're reading this page.
==== Notes ====
:* Please keep in mind, that OpenEMR's lists system has a 31 character limit for list ids and listitem ids.
:* If you don't have the list created in openemr already and/or your list id attribute isn't referencing a list, then the field won't show up in the GUI.
:* To find the list id for a list already in openemr, I recommend viewing the source of the 'edit list' administration page.


== formscript.pl ==
== formscript.pl ==

Revision as of 06:19, 22 November 2010

The XML based form generator (xmlformgen) is available at the following link:

XML Form Generator

It contains a series of XSLT stylesheets, a Makefile, and a pile of .xml files.

The XML files contain example form definitions. this is a series of xml files containing forms, for you to draw from when writing your own forms.

Dependencies

This form generator uses xalan-c++ to interpret the contents of XSLT files. it also uses a simple Makefile, so requires (likely) GNU Make.

Filesystem access is required to install a generated form into an OpenEMR installation.

Using

Compiling an Example Form

To 'compile' a form, open up a terminal, go to the directory you have extracted xmlformgen into, and type "make INFILE=filename.xml", where filename.xml is the name of a xml document you've created, or one of the .xml files that comes with xmlformgen. This will create a directory with 7 .php files, and one .sql file, hopefully conforming to The Forms API.

Importing a Form

To import one of these forms, copy the folder containing the generated files to the interface/forms location in your openemr install. Login to your OpenEMR install as the 'administrator', to the administration->forms page, and the form should be shown at the bottom of the page as a form ready-to-install. Register it, run its sql, enable it, and you're done!

Format of a XML Input File

Comments

XML style comments can be applied anywhere an element would be placed. they should be formatted like the following:

  <!-- MHP Progress Note -->
  <!-- this OpenEMR form has not yet been approved by CRRT -->

Required Parts of a Form

XML Header

Input files should start with a header, defining the file as an XML document.

<?xml version="1.0" encoding="ISO-8859-1"?>

Open the form tag

The form tag contains the contents of your form. there should only be one form tag per document, at the top opening the document, and a closing tag at the bottom of the file.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Example form -->
<form>
<!-- Form contents go here. -->
</form>

The Table Entity

Content

This entity's contents indicate the sql-safe name of the table where the data for this form will be stored.

Attributes

The 'type' option indicates the table type.

  • form indicates that this form happens in an encounter, and it will not have a revision history. (this is the normal behavior of forms in OpenEMR)
  • extended indicates that this form can fall outside of the encounter system (like the 'history' page), but it doesn't prevent it from being part of the encounter system. Mainly, it gives us a form that saves edit history. the 'history style' link for the page will show the most recent form for the given client that was 'signed' via the signatures method below.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Example form -->
<form>
 <table type="form">form_example</table>
 <!-- Form contents go here. -->
</form>

The RealName Entity

This entity contains the name of the form as it will show up in OpenEMR. Single ticks should be escaped PHP style.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Example form -->
<form>
 <table type="form">form_example</table>
 <RealName>Example Form</RealName>
 <!-- Form contents go here. -->
</form>

The safename Entity

This entity contains the html-safe directory-name-safe name of the form. this will be the name of the directory xmlformgen creates, and populates with files, along with the name used for internal variables in the form.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Example form -->
<form>
 <table type="form">form_example</table>
 <RealName>Example Form</RealName>
 <safename>example</safename>
 <!-- Form contents go here. -->
</form>

The style Entity

The style entity indicates what 'style' to use when drawing the form, and the number of columns wide to make the form.

Content
  • layouts: visual style similar to the layout engine (non-encounter forms)
  • paper: visual style is more similar to the encounter system forms style
Attributes
  • cells_per_row: indicates how many columns you want to lay out your fields in. (i.e., how many <td>s per <tr>)
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Example form -->
<form>
 <table type="form">form_example</table>
 <RealName>Example Form</RealName>
 <safename>example</safename>
 <style cells_per_row="4">paper</style>
 <!-- Form contents go here. -->
</form>

Notes about RealName, and safename

Both of these names will show up in the `registry` table of the mysql database. 'RealName' will be in `registry`.`name` and 'safename' will be in `registry`.`directory`

Optional Form Components

The Acl Entity

We don't know exactly how to configure this, but the code is templated from openemr code, and its reported to work by a user. It is not required.

Content

The content of the acl entity is the name of the 'type of information' we require the user have permissions to.

Attributes

  • table:
<acl table="patients">med</acl>


Describing Your Form

Forms generated by the XML form generator are broken into sections, which are collapsable. each of these sections contains a series of fields, laid out on a 'grid'. Structurally, this means that all of your fields MUST be contained inside of sections, and all of your sections MUST be inside of a manual or layout entity(described next).

Manual and Layout Entities

The <manual> tag and the <layout> tag both enclose a section of the XML document that contains sections and fields the form generator will generate. The difference between the tags is that layout will create a php page that honors the layout engine (this functionality is not commonly tested), whereas manual uses xmlformgen's internal engine to generate the form contents (and is recommended). you MUST place all your fields within sections, and all your sections inside of either a manual or a layout section.


Section Entities

The <section> tag begins a named, collapsible section of the form.

Content

The contents of this tag should consists only of field entities, as described below.

Required Attributes

  • name: indicates the name used for the div in the html.
  • label: indicates the visible name of the secton that will show up in the GUI and (I assume in the <layout> mode will be the name of the section that goes into the `layout_options`.`group_name` field.

Example

<section name="client_info" label="Client Info">
 <!--- field entities go here -->
</section>

Field Entities

Each field on your form is represented by a field entity. a field entity describes the fields at every level: sql table structure, look, behaviors, etc. fields have no content, only attributes, and therefore can be self-closed as shown below:

<field [put some attributes here] />

Common Attributes

The most important attribute is the 'type' attribute. this attribute specifies the 'type' of the field (and is an abuse of xml, IMO). this dictates its display properties, behaviors, and other attributes required.

  • type: dictates the data type both for the html form field and the sql table. (more on this below, as each type dictates further required and optional attributes)

Some other attributes are required for most fields:

  • name: dictates both the field's column name in the sql table and the name of the html object representing the field. The contents of this attribute need to be safe for both html field names, and mysql column table names.
  • label: dictates the label will be visible in the GUI. This attribute's contents must be escaped PHP style.
  • hoverover: dictates the title attribute of the html form field. In effect, this becomes the text that pops up when you hover your mouse over the field. It is believed that this attribute's contents must be escaped PHP style.
  • labelcols: dictates the number of columns that will be reserved for displaying the label in the form.
  • cols : dictates the number of columns that will be reserved for displaying the field in the form.

Field Types, and Type Specific Attributes

textfield

fields with a type of 'textfield' are useful for containing a field with a hard limit on text contents.

Required Attributes
    • maxlength: dictates the varchar length of the table column where the list data will be stored
Optional Attributes
    • length: dictates the size of the html field used for input - defaults to 10 characters
Example
<field name="test_textfield" label="Textfield" type="textfield" hoverover="A Text Field" length="50" maxlength="255" labelcols="1" cols="3"/>
TextBox

Fields with a type of 'textbox' are useful for containing narrative contents, EG, paragraphs of text. Textboxes are capable of containing up to 64K of text.

Attributes

TextBoxes have no attributes other than the ones required for all fields.

Example
<field name="test_textarea" label="Textarea" type="textarea" rows="10" columns="80" labelcols="1" cols="1"/>
The textarea Type

Fields with the textarea type are capable of containing 64k of text in a box.

Optional Attributes
    • rows: indicates the number of rows in the visible textarea - defaults to 4
    • columns indicates the number of columns in the visible textarea - defaults to 40
<field name="test_textarea" label="Textarea" type="textarea" rows="10" columns="80" labelcols="1" cols="1"/>
The checkbox_list Type

The checkbox_list field type creates a set of checkboxes, which allows for multiple checkboxes to be selected.

Required Attributes
    • list: this references the 'listid' of a list in a <list> tag (which, itself, should refrence the listid from the list_options table)
Example
<field name="test_checkbox" label="Checkbox" type="checkbox_list" list="yesno" hoverover="" labelcols="1" cols="1"/>
The dropdown_list type

The dropdown_list field type creates a dropdown list which allows for individual selections to be saved.

Required Attributes
    • list: this references the 'listid' of a list in a <list> tag (which, itself, should refrence the listid from the list_options table)
    • maxlength: dictates the varchar length of the table column where the list data will be stored
Example
<field name="test_dropdown" label="Dropdown" type="dropdown_list" list="status" maxlength="30" hoverover="" labelcols="1" cols="1"/>
The date Type

Fields with a date type are meant for storing a date in. on input forms, this draws a calendar widget next to the field. This type has no additional attributes required.

<field name="test_date" label="Date" type="date" hoverover="" labelcols="1" cols="3"/>
The provider Type

provider: creates an int(11) field that references the "providers" from the `users` table. The provider type has no additional attributes required.

<field name="test_provider" label="Provider" type="provider" hoverover="" labelcols="1" cols="1"/>

Lists

Every list used in the field entities above should have a list entity representing it. Lists can be either lists that are already in openemr (internal lists), or can be created as part of importing the form. In cases where you're not having the form import the lists(by setting the import attribute ="no") there is no need to have content for these entities, and the list tag can close itself.

Example List

<list name="yesno" label="Yes/No" type="standard" id="yesno" import="yes">
 <listitem id="NO" label="NO" order="1">NO</listitem>
 <listitem id="YES" label="YES" order="2">YES</listitem>
</list>

Example Internal List

<list name="marital_status" label="Marital Status" type="standard" id="marital" import="no"/>

Notes

  • Please keep in mind, that OpenEMR's lists system has a 31 character limit for list ids and listitem ids.
  • If you don't have the list created in openemr already and/or your list id attribute isn't referencing a list, then the field won't show up in the GUI.
  • To find the list id for a list already in openemr, I recommend viewing the source of the 'edit list' administration page.

formscript.pl

Q: hey, Out of curiosity is this using the formscript.pl script? Just noted it in the 'make' file?

A: Not at all. its meerly there because i was using it for comparison purposes.