misc: disable form (buttons) on submit (#13349)

This commit is contained in:
Frédéric Péters 2018-02-10 20:12:56 +01:00
parent 21a87544b7
commit 59a6416ace
2 changed files with 10 additions and 0 deletions

View File

@ -239,6 +239,7 @@ class FormStatusPage(Directory):
response.content_type = 'text/plain'
return "Your browser should redirect you"
get_response().add_javascript(['jquery.js', 'qommon.forms.js'])
self.html_top(self.formdef.name)
context = {
'view': self,
@ -448,6 +449,7 @@ class FormStatusPage(Directory):
return "Your browser should redirect you"
get_logger().info('form %s - id: %s - view status' % (self.formdef.name, self.filled.id))
get_response().add_javascript(['jquery.js', 'qommon.forms.js'])
self.html_top('%s - %s' % (self.formdef.name, self.filled.id))
r = TemplateIO(html=True)

View File

@ -46,4 +46,12 @@ $(function() {
$(first_field_with_error)[0].focus();
}
}
$(window).bind('pageshow', function(event) {
$('form').removeClass('disabled-during-submit');
});
$('form').on('submit', function() {
var $form = $(this);
$form.addClass('disabled-during-submit');
return true;
});
});