Skip to content

LORIS Form

christinerogers edited this page Oct 28, 2016 · 30 revisions

under construction


As of LORIS 17.0 (late 2016), LorisForm will replace HTML QuickForm

How to update PHP QuickForm instruments to LorisForm

This section is ONLY for existing projects updating to Loris 17.0

Since LorisForm is designed to match HTML QuickForm, update each of your instruments to LorisForm:

  • Find and replace :
   $this->form = new HTML_Quickform('test_name');

and replace with this line:

    $this->form = new LorisForm('test_name');
  • Remove any further references to QuickForm such as:
    require_once 'HTML/QuickForm.php';
    require_once 'HTML/QuickForm/Renderer/Array.php';
  • addGroupRule has new restrictions...

Other updates unrelated to LorisForm:

  • Timestamp fields may require updating to MySQL 5.7 standards (this is not a LorisForm issue)
  • Multi-page PHP instruments: call_user_method has been been deprecated in PHP7 (To update: use call_user_func instead, and swap your arguments)

There's no need to modify any other code or configurations or tables -- just don't forget to run composer install --no-dev and then composer dump-autoload to update dependencies and re-generate the autoload.php file.
Database tables and data are unaffected by the switch to LorisForm.

For a few examples, see our LorisForm updates to the sample instruments provided in the docs/ directory

About LorisForm

Loris Form permits specific element types to match those generated by the Instrument Builder:

  • dropdown select
  • multiselect
  • textbox (brief text answers)
  • text area
  • numerical
  • date
  • label
  • score columns (static for calculated values, not for data entry)

Note on Radio buttons and Checkboxes

Radio buttons and checkboxes are not allowed by Loris Form for a very important reason: distinguishing No from Not Answered in data entry responses is critical for statistical validity of clinical data.

  • A checkbox left blank doesn’t distinguish a No response from Not Answered (or Ignored)
  • Each individual radio button is treated by PHP as a separate form element and so would require a separate database field for every valid response to a single question. For binary (yes/no) questions, a select-dropdown (options: yes/no/NotAnswered) is still preferable anyway, in order to distinguish No from Not Answered.
Clone this wiki locally