-
Notifications
You must be signed in to change notification settings - Fork 175
LORIS Form
As of LORIS 17.0 (late 2016), LorisForm will replace HTML QuickForm
This section is ONLY for existing projects updating to Loris 17.0
Since LorisForm is designed to match HTML QuickForm, to update each of your instruments to LorisForm, remove/replace the following:
- Replace Quickform references:
$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';
- Remove calls to
registerRule()
- this function is deprecated in LorisForm (excludes XINRegisterRule())
- Add additional validation for all MultiSelect form fields, to ensure that users see an informative error message if the multi-select fails default form validation
- Replace
addGroupRule()
withaddRule()
(example), since date fields are now strings instead of arrays - Remove calls to
addRule()
usingcheckdate
$this->addRule(
'Date_taken',
'Date of Administration is invalid',
'checkdate'
);
$this->_page($matches[1])
and replace with this line:
call_user_func(array($this, $matches[1]));
- Elements including groups and labels are required to have unique names in order to be displayed on the front end. Uniqueness is required within a single page of an instrument.
- Timestamp fields may require updating to MySQL 5.7 standards (this is not a LorisForm issue)
- Replace
call_user_method
(deprecated in PHP7) withcall_user_func
- note this involves swapping your arguments (example here)
Note on dependencies: Don't forget to run
composer install --no-dev
and thencomposer dump-autoload
to update dependencies and re-generate the autoload.php file.
Database tables and data are otherwise unaffected by the switch to LorisForm.
For a few examples, see recent updates to sample instruments in the docs/instruments directory for 17.0.
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)
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.