Set default button for enter key
Set default button for enter key
Loren Maxwell
Posts: 406Questions: 99Answers: 10
Somewhat of a related question for this post:
https://datatables.net/forums/discussion/52211/leave-modal-open-after-adding-record
After setting it up, I have three buttons -- "Cancel", "Save", and "Save and add another".
Is there a way to specify which button will be pressed on the editor form when the user hits the "Enter" key?
By default it presses the "Save" key but I might like to set it to "Save and add another".
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
No I'm afraid not. The entry key doesn't actually trigger any of the the buttons - instead it just calls
submit()
.That said, there is an alternative approach you can take. The
form-options
object has anonReturn
option that can be used as a function. You could define that function to be:which should do the job.
Allan