Validating Data in AdapTable
Summary
- AdapTable provides 3 times of validation:
- pre-edit validation via ReadOnly cells
- post-edit validation on the Client via Validation Alerts
- post edit server validation
AdapTable allows users / developer to perform validation in 3 ways to cover different use cases.
Pre-editing Validation
Pre-editing validation is performed using Read-Only (or Editable) cells.
AdapTale prevents cells which meet the read-only rule from being edited, before a new value can be provided.
Note
AdapTable will evaluate whether the cell can be edited, ie. the evaluation is done on the existing cell value
Find Out More
- See Pre-Edit Validation for more information
Post-editing Client Validation
AdapTable can be configured with Validation Alerts which will trigger when an Edit breaks an Alert rule.
They have a behaviour of PreventEdit which means that the data change is automatically rolled back.
Validation Alerts can be defined at design-time in Alert State, or created by run-time users.
Find Out More
- See Client Validation for more information
Post-editing Server Validation
Additionally AdapTable offers Server Validation.
This is configured using properties in Edit Options.
A function is invoked which is given details of the proposed edit and is handled "externally".
The function returns a result that either allows, disallows or overrides the new cell value.
Find Out More
- See Server Validation for more information
- This example shows all 3 types of validation (using the
LanguageColumn):- Pre-editing Validation sets all cells with the value HTML to be readonly
- Client Validation prevents the value being changed to Python
- Server Validation has 2 rules; (1) it disallows the value of JQuery; (2) it changes a value of C to C#
Expand to see the Code used
- In the
LanguageColumn:- try to change a cell with HTML and note its not allowed; change a different cell to HTML and note the new cell is now not editable
- change a cell to Python and see how it triggers a Prevent Edit Alert
- change a cell to JQuery and see how it gets reverted; set it to C and note how it gets automatically updated to C#