enable 'save' buttons on form changes

This commit is contained in:
Frédéric Péters 2014-04-10 15:36:09 +02:00
parent f6b5877928
commit 4f1b60c11b
1 changed files with 7 additions and 1 deletions

View File

@ -46,7 +46,7 @@
<p>
<form class="small">
{{ service|as_update_form }}
<button disabled="disabled">{% trans 'Save' %}</button>
<button class="enable-on-change" disabled="disabled">{% trans 'Save' %}</button>
</form>
</div>
{% endfor %}
@ -87,6 +87,12 @@ $(function() {
$("div[data-wants-check='true']").each(function(index, element) {
$(element).operational_check();
});
$('button.enable-on-change').each(function(index, element) {
var button = $(element);
$(element).parent('form').find('input').on('change keydown',
function() { $(button).prop('disabled', null); });
});
});
</script>
{% endblock %}