1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
var checkCategories = {
checkSlug : function (slug){
if (document.formAjouter_Categorie.slug.value.length == 0){
alertify.alert("Le champ nom doit être renseigné");
return false;
}
if(document.formAjouter_Categorie.slug.value == (/^[a-z\-0-9]+$/)){
alertify.alert("Le slug est incorrect");
return false;
}
},
checkName : function (name){
var mini = 2
var maxi = 25
if (document.formAjouter_Categorie.name.value.length == 0){
alertify.alert("Le champ nom doit être renseigné");
return false;
}
if (mini != 0) {
if (document.formAjouter_Categorie.name.value.length < mini ) {
alertify.alert("Le nom de la catégorie doit comporter au moins " + mini + " caractères.");
return false;
}
}
if (maxi != 0) {
if (document.formAjouter_Categorie.name.value.length > maxi ) {
alertify.alert("Le nom de la catégorie ne doit pas comporter plus de " + maxi + " caractères.");
return false;
}
}
}
} |