Download the PHP package webtorque/silverstripe-nhi-field without Composer
On this page you can find all versions of the php package webtorque/silverstripe-nhi-field. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webtorque/silverstripe-nhi-field
More information about webtorque/silverstripe-nhi-field
Files in webtorque/silverstripe-nhi-field
Package silverstripe-nhi-field
Short Description Provide a NHI db field and NHI Form field to track NZ's "National Health Index" number.
License MIT
Informations about the package silverstripe-nhi-field
silverstripe-nhi-field
A Silverstipe module to provide a NHI db field and NHI Form field to track NZ's "National Health Index" number.
Features
- Custom DB field type
- Custom form field type with basic pattern validation and checksum validation.
- Consistently save NHI in all caps.
Requirements
- PHP 5.4 or greater (tested with up to PHP 7.1)
silverstripe/framework:^3.0
silverstripe/cms:^3.0
Installation
Usage
To specify a NHI db field on a DataObject:
The NHI
field type is equivalent to Varchar(7)
. When scaffolding a form, any NHI db field will autmatically use the
NHIField
form field instead of TextField
.
Validating an NHI
Just use the NHIField
in your form and validate your Form normally.
NHIField
is a simple extension of TextField
with the following alteration:
- The
maxlength
is automatically set to 7. - When setting the value of the field, it will automatically be converted to uppercase.
- The value is validated with a basic regex and with a checksum as specified by the NHI standard.
- You can ouput an html5
pattern
attribute with$nhiField->setHtml5Pattern(true);
.
For testing purposes, checksum validation can be disabled by setting the disable_checksum_validation
flag on the NHIField
config.
All versions of silverstripe-nhi-field with dependencies
silverstripe/framework Version ^3.0.0
silverstripe/cms Version ^3.0.0