Keep focus/selection on invalid field

Keep focus/selection on invalid field

hdissinghdissing Posts: 4Questions: 2Answers: 0

Palying with the example on 'Excel like keyboard navigation' here https://editor.datatables.net/examples/extensions/keyTable.html
When entering an invalid date in 'Start date' and then pressing one of the arrows on keyboard, data is submitted and an error returned. The invalid field seems to keep focus (accepting keyboard input), but another field is 'marked' as active (if left arrow is pressed, the field to the left etc.). Furthermore, when value is corrected to a valid date, it can't be submitted by pressing one of the arrow keys. You have to press Enter.
The behaviour I would like is this:
When a field fails validation, refocus the field - in ex. keep the frame that indicate active field and select/highlight the entered value and allow submitting using keyboard arrows (not just Enter). A kind of reset...
Is this possible? And how would it be accomplished in the mentioned example?

Answers

  • hdissinghdissing Posts: 4Questions: 2Answers: 0

    Addition: When entering an invalid date in the last row on a page and pressing down arrow, the current behaviour means that you are placed on first row on next page. The invalid field including the errormessage is out of sight, and there is no indication of why you can't type into selected field. This is confusing for users.

This discussion has been closed.