Cancel key-blur when field contains errors?
Cancel key-blur when field contains errors?
Is it possible to cancel all KeyTable navigations when a field contains an error?
Example: https://editor.datatables.net/examples/extensions/keyTable.html
- Click any first name field. This field is required.
- Hit the Delete key to clear the field
- Click any other column to trigger key-blur
The behavior right now is that the selected "first name" is reverted to its original value, because an empty value is a field error.
Instead I'd like the field to stay focused until the user fixes their mistake, or until they explicitly hits the Esc key.
Can it be done? Perhaps with the right combinations of form-options
and some custom code in close/blur events.
Answers
You could use
keys.disable()
to disable KeyTable (thenkeys.enable()
to enable it). That could be done in the event handlers from Editor such aspostSubmit
.Allan