Cancel key-blur when field contains errors?

Cancel key-blur when field contains errors?

sliekenssliekens Posts: 97Questions: 17Answers: 2

Is it possible to cancel all KeyTable navigations when a field contains an error?

Example: https://editor.datatables.net/examples/extensions/keyTable.html

  1. Click any first name field. This field is required.
  2. Hit the Delete key to clear the field
  3. 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

  • allanallan Posts: 50,034Questions: 1Answers: 7,401 Site admin

    You could use keys.disable() to disable KeyTable (then keys.enable() to enable it). That could be done in the event handlers from Editor such as postSubmit.

    Allan

This discussion has been closed.