Skip to content
Snippets Groups Projects
Commit 4e4704ac authored by Timothee P's avatar Timothee P :sunflower:
Browse files

prevent custom field empty options

parent eb50668f
No related branches found
No related tags found
No related merge requests found
......@@ -293,6 +293,12 @@ export default {
checkCustomForm() {
this.form.label.errors = [];
this.form.name.errors = [];
this.form.options.errors = [];
console.log(
this.form.field_type.value,
this.form.field_type.value === "list",
this.form.options.value.length < 2
);
if (!this.form.label.value) {
//* vérifier que le label est renseigné
this.form.label.errors = ["Veuillez compléter ce champ."];
......@@ -313,6 +319,13 @@ export default {
"Les champs personnalisés ne peuvent pas avoir des noms similaires.",
];
return false;
} else if (
this.form.field_type.value === "list" &&
this.form.options.value.length < 2
) {
//* s'il s'agit d'un type liste, vérifier que le champ option est bien renseigné
this.form.options.errors = ["Veuillez compléter ce champ."];
return false;
}
return true;
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment