Autofocus the email field in the signup form, and submit on enter key

This commit is contained in:
Pēteris Caune 2019-10-12 20:22:28 +03:00
parent 163b020116
commit 4625196ded
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
2 changed files with 14 additions and 1 deletions

View File

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- Add Go usage example
- Send monthly reports on 1st of every month, not randomly during the month
- Signup form sets the "auto-login" cookie to avoid an extra click during first login
- Autofocus the email field in the signup form, and submit on enter key
### Bug Fixes
- Prevent double-clicking the submit button in signup form

View File

@ -1,6 +1,6 @@
$(function () {
$("#signup-go").on("click", function() {
function submitForm() {
var base = document.getElementById("base-url").getAttribute("href").slice(0, -1);
var email = $("#signup-email").val();
var token = $('input[name=csrfmiddlewaretoken]').val();
@ -18,6 +18,18 @@ $(function () {
});
return false;
}
$("#signup-go").on("click", submitForm);
$("#signup-email").keypress(function (e) {
if (e.which == 13) {
return submitForm();
}
});
$("#signup-modal").on('shown.bs.modal', function () {
$("#signup-email").focus()
})
});