Commit a029dac6 authored by Anatole Rakotoson's avatar Anatole Rakotoson

modif multivalidation pour ajouter validation siret

parent f25a246e
...@@ -168,7 +168,8 @@ $paramsData = [ ...@@ -168,7 +168,8 @@ $paramsData = [
"validation" => [ "validation" => [
"text" => "texte", "text" => "texte",
"number" => "Nombre", "number" => "Nombre",
"email" => "adresse mail" "email" => "adresse mail",
"unique" => "Siret"
] ]
]; ];
...@@ -296,13 +297,32 @@ if($mode == "r"){ ?> ...@@ -296,13 +297,32 @@ if($mode == "r"){ ?>
$(this).parent().addClass('true-validate'); $(this).parent().addClass('true-validate');
} }
answer.path = "answers."+$(this).data("form")+"."+$(this).data("id"); if($(this).attr('type') == 'unique' ) {
answer.collection = "answers" ; ajaxPost(null, baseUrl+"/co2/search/globalautocomplete", {"searchType" : ["organizations"], "filters": { "siret" : [$(this).val()] }},
answer.id = "<?php echo $answer["_id"]; ?>"; function (data){
answer.value = $(this).val(); if (data.results.lenght != 0){
dataHelper.path2Value(answer , function(params) { toastr.error('cette organisation existe déjà');
//toastr.success('saved'); } else {
}); answer.path = "answers."+$(this).data("form")+"."+$(this).data("id");
answer.collection = "answers" ;
answer.id = "<?php echo $answer["_id"]; ?>";
answer.value = $(this).val();
dataHelper.path2Value(answer , function(params) {
//toastr.success('saved');
});
}
}
);
} else {
answer.path = "answers."+$(this).data("form")+"."+$(this).data("id");
answer.collection = "answers" ;
answer.id = "<?php echo $answer["_id"]; ?>";
answer.value = $(this).val();
dataHelper.path2Value(answer , function(params) {
//toastr.success('saved');
});
}
} }
}) })
}); });
...@@ -338,8 +358,6 @@ if($mode == "r"){ ?> ...@@ -338,8 +358,6 @@ if($mode == "r"){ ?>
$(thisAlert).removeClass('alert-validate'); $(thisAlert).removeClass('alert-validate');
} }
</script> </script>
<?php } ?> <?php } ?>
......
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