diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js new file mode 100644 index 000000000..c6ec7c789 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js @@ -0,0 +1,16 @@ +/** + * Submit button(s) are disabled as soon as submit button is clicked and form is submitted. + * ID 'create-form' must be added to submit forms. + */ + +var form = document.getElementById('create-form'); +var submitButtons = document.querySelectorAll("[type=submit]"); + +form.addEventListener('submit', function(e){ + for(var i=0; i {% endif %} - {{ form_start(form) }} + {{ form_start(form, {'attr' : {'id' : 'create-form'}}) }} {{ form_row(form.lastName, { 'label' : 'Last name'|trans }) }} @@ -104,3 +104,7 @@ {% endblock content %} + +{% block js %} + {{ encore_entry_script_tags('mod_disablebuttons') }} +{% endblock js %}