Commit a54bcc00 authored by Mat's avatar Mat
Browse files

form.addEventListener n'écoutait pas le formInsert

parent 9946d4bf
......@@ -58,6 +58,6 @@ class OffreLegumesInsertType extends AbstractType
public function getBlockPrefix()
{
return 'offre_legumes_insert_type';
return 'offre_legumes_insert';
}
}
......@@ -451,7 +451,7 @@
let tpage = document.querySelector('#t_pages');
let form = document.querySelector('form[name=legume]');
let titleForm = document.querySelector('#form-legume');
let formInsert = document.querySelector('form[name=offre_legumes_insert]');
let paginate = { 'step': 10, 'page': 1, 'column': 'id', 'order': 'ASC' };
......@@ -474,7 +474,9 @@
/*
* Bouton pour ajouter une nouveau légume
*/
let titleForm = document.querySelector('#form-legume');
let createBtns = document.querySelectorAll('.btn-create');
createBtns.forEach(function(createBtn) {
createBtn.addEventListener('click', function()
{
......@@ -494,8 +496,9 @@
});
});
/*
* Soumission du formulaire
* Soumission des formulaires
*/
form.addEventListener('submit', function(e)
{
......@@ -505,11 +508,22 @@
{
reloadTableLegume(paginate);
$('.form-legume-modal').modal('hide'); // en jquery
$('.form-offre-legume-insert-modal').modal('hide'); // en jquery
},
form);
});
formInsert.addEventListener('submit', function(e)
{
let formInsert = this;
e.preventDefault();
AJAX('POST', submitURL, function()
{
reloadTableLegume(paginate);
$('.form-offre-legume-insert-modal').modal('hide'); // en jquery
},
formInsert);
});
/*
* Définir le pas de la pagination
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment