• English
  • Français (French)

Available items for patient forms

The forms are constructed of items. The form items can be:

  • graphical presentation elements (form items or combined items)
  • graphical input (CheckBoxes, TextAreas, …)

Forms are encoded in one or more XML files whose structure must meet specific rules. It is necessary to define at least one form item (see below). The values ​​of these items are automatically saved and restored in/out of the database without additional code.

Form creation: XML code

  • The form items may be declared using of XML attributes
  • The form type declaration is not mandatory
  • You can include sub-forms within your forms using file inclusion (with the line tag)
  • It is possible to associate scripts with forms

Forms:

  <!-- Form declaration without using attributes -->
  <MedForm>
    <type>form</type>
    <name>Unique::Identifier</name>
    [...]
  </MedForm>
 
  <!-- Form declaration using attributes -->
  <MedForm type="form" name="Unique::Identifier">
    [...]
  </MedForm>
 
  <!-- Inclusion of XML files -->
  <file>__subforms__/foo/bar/central.xml</file>
 
  <!-- Inclusion of script files -->
  <file type="script" name="onload">./scripts/xx/script.js</file>

Items:

  <!-- Item declaration without using attributes -->
  <Item>
    <type>check</type>
    <name>Unique::Identifier</name>
    [...]
  </Item>
 
  <!-- Item declaration using attributes -->
  <Item type="check" name="Unique::Identifier">
    [...]
  </Item>

Assigning identifiers to items

All form and form items must be identified by a unique identifier. These identifiers must be persistent over time (in case of updating the form). They are used for data storage in the database.

It is best practice to avoid naming conflicts, so use namespaces.

Namespaces can be separated by ::, :, ., __, but preferrable is ::

Creating form using QtDesigner

You can use QtDesigner to create complex presentation forms. Then you have two files (at least):

  • a XML descriptor file for FreeMedForms
  • interface files (*.ui created by QtDesigner).

For more information about this feature, see the creation of form items below.

Generic options

XML

Options are defined by the options tag: <options>Option1;Option2</option>
Options must be separated by a semicolon;

Common options

  • labelonleft: the label of the item will be placed to the left of the item in the form (default)
  • labelontop: the label of the item will be placed above the item
  • compact: Compact views (limit space used by the item)
  • notprintable: By default all items will be included in a print request. Use this option to remove the printing of an item (or more subitems, if the item is a container).

Grouping (forms, pages and groups)

The form item

The form item defines a patient's form. It can contain multiple other items or even a complete other form item (nested forms). It is essential to define at least one item form.

  <MedForm name="GP::Basic::IdentityForm" uifilename="v0.6.2+">
    <label lang="xx">Identity</label>
    <label lang="fr">Identité</label>
    <options>unique</options>
   <icon>__theme__/identity.png</icon>
  </MedForm>

Available options:

  • Column: You can set the number of columns using the column tag:
  • <column>2</column>
  • Single: a single record in the database. It is not possible to create more episodes for this form (e.g. for identity).
  • NoEpisode: no records will be created in the database for items inside this form item. You can use this option to group several items in the form tree (e.g. Drugs page of General Medicine form).
  • UseFormNameAsNameSpace (>=v0.6.2): you can simplify the writing of your forms by assigning a namespace (that matches the name of the form) to all items in that form. For example, the full name of the item One would be Form::Test::BlaBla::One and not only One.
  •   <MedForm name="Form::Test::BlaBla">
       <options>UseFormNameAsNameSpace</options>
       <Item name="One">...</Item>
     </MedForm>

Pages

to be done.

Groups

You can group items for improved readability of the form code. Groups have a header and a frame for its sub-items.
You can define country-specific groups using the country tag followed by a list of ISO country codes separated by semicolons. For example, to create a group specific to France, the code would be <country>FR</country>.

Available options (some are not implemented yet):

  • DontPrintTitle: Do not add group title at printing time (>= v0.6.2)
  • DontPrintEmptyValues: do not print if the content of the group is empty
  • Checkable: adds a group checkbox
  • Collapsible: the group becomes 'collapsed' / 'expanded'
  • Grid: a grid used to store items
  • FormGrid: uses a grid form to arrange the elements (not available)
  • NoGrid: items are displayed as is one after the other (not available)

You can set the number of columns using the column tag

<Column>2</column>

Complete example of the project is here in git.

  <Item type="group" name="sampleGroup">
    <country>FR</country>
    <option>Compact</option>
    <label lang="xx">Title</label>
 
    [... SubItems ...]
 
  </Item>

Simple Items

HelpText

A HelpText is a text box that does not interact with user input and can be used to display help, information, etc. There are no values to store in the database and no other interactions with the user interface. It can be omitted when printing using the following options:

  • printable The text is included in the print (default)
  • notprintable The text is not printed
    <Item name="HelpText" type="helptext">
      <label lang="xx">This a simple help text</label>
      <label lang="fr">Ceci est texte d'aide</label>
      <options>printable</options>
      <value>
        <default>The default value</default>
      </value>
   </Item>

Text Input Areas

Short text

Available Options:

  • DontPrintEmptyValues: Don't print anything if the editor is empty.
    <Item name="ShortText" type="shorttext">
      <label lang="xx">Example of a line edit</label>
      <label lang="fr">Exemple de zone de saisie sur une ligne</label>
      <value>
        <default lang="xx">Default value</default>
        <default lang="fr">La valeur par défaut</default>
      </value>
   </Item>

Plain text block

Available Options:

  • DontPrintEmptyValues: Don't print anything if the editor is empty.
    <Item name="LongText" type="longtext">
      <label lang="xx">This a simple text edit without complex formatting</label>
      <label lang="fr">Exemple de zone de saisie textuelle brute et multi-ligne</label>
      <value>
        <default lang="xx">The default value</default>
        <default lang="fr">La valeur par défaut</default>
      </value>
   </Item>

Rich text block

Represents a multiline text block with ability to include formatted text, tables, images, etc.

Available Options:

  • DontPrintEmptyValues: Don't print anything if the editor is empty.
  • FullEditor: Complete editor(with printing, tables, file opening…)
  • WithTable: Basic editor (with enabled table editing)
  • WithIO: Basic editor with enabled file handling
  • Expanded: Extends the textbox height to 1000 pixels
    <Item name="GP::Basic::SOAP::S" type="texteditor">
      <label lang="xx">Subjective</label>
      <label lang="fr">Subjectif</label>
      <options>FullEditor</options>
    </Item>

Numeric Values

Spinbox

Represents a spinbox widget with two buttons (up/down) that only allows to enter numeric values. There are two types available:

  • spin: A spinbox for integer values
  • doublespin: A spinbox for double precision values

Available Options:

  • min: Minimum value (optional)
  • max: Maximum value (optional)
  • step: Up/down step when clicking the buttons (optional)
     <Item name="Spin1" type="spin">
       <label lang="xx">Spin</label>
       <min>0</min>
       <max>10</max>
       <step>2</step>
     </Item>
 
     <Item name="doublespin1" type="doublespin">
       <label lang="xx">Double Spin</label>
       <min>2.4</min>
       <max>9.8</max>
       <step>0.1</step>
     </Item>

Checkbox

Simple Checkbox

Represent a QCheckBox in the view.

Available Options:

  • printonlychecked: print value only if this option is checked
  • onright: checkbox is on the right side of the text (default: left)
  • labelastooltip: Use the label text as tooltip
  <Item name="CheckBox" type="check">
    <label lang="xx">This is a simple scripted checkbox sample</label>
    <label lang="fr">Exemple de case à cocher simple</label>
    <tooltip lang="xx">My tooltip</tooltip>
    <options>printonlychecked</options>
    <value>
      <numerical id="0">1</numerical>
      <numerical id="1">2</numerical>
    </value>
  </Item>
Radiobox
  <Item name="RadioBoxes" type="radio">
    <label lang="xx">There are the radio buttons</label>
    <label lang="fr">Exemple de cases à cocher multiples auto-exclusives</label>
    <value>
      <uuid id="0">first</uuid>
      <uuid id="1">second</uuid>
      <uuid id="2">third</uuid>
 
      <possible id="0" lang="xx">The first value</possible>
      <possible id="1" lang="xx">The second value</possible>
      <possible id="2" lang="xx">The third value</possible>
 
      <possible id="0" lang="fr">Première valeur</possible>
      <possible id="1" lang="fr">Seconde valeur</possible>
      <possible id="2" lang="fr">Troisième valeur</possible>
 
      <numerical id="0">1</numerical>
      <numerical id="1">2</numerical>
      <numerical id="2">4</numerical>
    </value>
  </Item>

Dates

You can set the display format using the XML tag DateFormat. You can see all the available format types in the official Qt documentation

Available Options:

* now: Set the default value to the creation time of the form item (e.g. user creates a new episode) * patientLimits: use patient data (date of birth and date of death) to define the boundaries of the editor (minimum date, maximum date)

   <Item name="SampleDateEdit" type="date">
     <dateformat>dd MM yyyy</dateformat>
     <label lang="xx">This a date editor</label>
     <label lang="fr">Exemple d'éditeur de date et heure</label>
     <options>now;patientLimits</options>
  </Item>

Lists and List Selectors

en/manuals/freemedforms/xmlforms/widgets.txt · Dernière modification: 2012/10/08 23:40 par Christian A. Reiter
Recent changes RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki FreeMedForms © Eric Maeker, MD