fields.errorText
Error message to display when a field is in error.
Please note - this property requires the Editor extension for DataTables.
Description
This string is used when a field is found to be invalid via HTML 5 validation attributes or true is passed to field().error()
Unlike with server-side validation where specific strings can be given for each validation constraint, this should be given as a generic message for the field, describing what input is required for the field to be valid, as only a single error message can be shown via this method.
It is also important to highlight that in addition to client-side validation, you must use server-side validation, since client-side validation can easily be bypassed.
Type
This option can be given in the following type(s):
Example
Use HTML 5 validation with an error message:
const editor = new DataTable.Editor({
ajax: 'php/staff.php',
table: '#myTable',
fields: [
{
label: 'Extension:',
name: 'extn',
attr: {
min: 1000,
max: 5000,
required: true,
type: 'number'
},
errorText: 'Extension number must be between 1000 and 5000'
}
]
});