Handle ajax errors on SIRET form

This commit is contained in:
Paul Chavard 2018-03-27 11:26:42 +02:00
parent a17ac5a9db
commit 2fc03e9079

View file

@ -1,4 +1,6 @@
$(document).on('turbolinks:load', the_terms);
$(document)
.on('turbolinks:load', the_terms)
.on('turbolinks:load', handle_siret_form_errors);
function the_terms() {
var the_terms = $("#dossier_autorisation_donnees");
@ -41,3 +43,13 @@ function toggle_etape_1() {
$('.row.etape.etape_1 .etapes-menu #logos').toggle(100);
$('.row.etape.etape_1 .etapes-informations #description_procedure').toggle(100);
}
function handle_siret_form_errors() {
$(".form-inline[data-remote]").on("ajax:error", function(event) {
var input = $('#dossier-siret', event.target);
if (input.length) {
var invalid_siret = input.val();
error_form_siret(invalid_siret);
}
});
}