Commit a029dac6 authored by Anatole Rakotoson's avatar Anatole Rakotoson

modif multivalidation pour ajouter validation siret

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