Additional fields allow you to extend the system by adding any extra fields that you need in order to record additional custom data. They are available anywhere there is a ‘record’ style page, where there are navigation tabs in the page (currently pupil, medical, sen, and extneral providers).
Creating Fields #
Fields get created in the module they are supposed to show in. Head to the module landing page and then into the configuration of the module. From there, there is a link to Additional Fields. This page will list fields in the module and allow you create more.
Field Types #
When adding a new field, the available types are:
- Colour Picker – allows you to select a colour
- Date – allows a date with a date picker with no time
- Decimal – allows a decimal numeric value. Can be useful for hours per week, 38.5 for example
- Email – an email field with front end validation to require a valid email address
- Number – allows a numeric value
- Dropdown – a select/dropdown field which links to a list of options. Any list can be used, including new custom lists. Can be made to allow multiple selections in list
- Text – a basic text box
- Text Area – a WYSIWYG text editer
- Time – a time field with no date
Validation Rules #
The above fields are provided without much validation on the data entered to them. By default it will only be front end, browser based validation. For example, an email field will check that it is an email address if a modern browser is used and it supports checking the provided value. However, if the field type is changed it may then accept a normal text field without checking that the value is actually an email address but you can add extra validation rules on to enforce this.
The system is built on CodeIgniter as a base, and any rule that can be used in the ‘General Use’ section of their guide page can be used with these. The rules can be found here: https://codeigniter.com/user_guide/libraries/validation.html#
The rules will need to be provided in a JSON format (https://www.w3schools.com/js/js_json_intro.asp) and will general have three areas in the JSON area:
- Label – this is the friendly name of the field and what you want to show to the user if a value fails validation
- Rules – this is the list of validation rules that you want to apply to the field. If there are multiple rules you need, separate with a vertical pipe: ‘|’
- Errors – These are the messages given to the user for each rule if a value fails validation. There should be a line for each rule provided.
Below is an example validation rule for an email address:
{
"label": "Family Email Address",
"rules": "required|valid_email",
"errors": {
"required": "{field} is required",
"valid_email": "{field} is not a valid email Address, {value}"
}
}
Before putting a rule in the system, it is best to check that rule is valid JSON. This can be done here: https://jsonlint.com/ If a rule is entered with invalid JSON it may lead to the rule not working and invalid data being allowed.