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

check for irregular characters

parent e9890953
Branches
Tags
No related merge requests found
......@@ -249,12 +249,14 @@ export default {
}
this.updateStore();
},
removeCustomForm() {
this.$store.commit(
"feature_type/REMOVE_CUSTOM_FORM",
this.customForm.dataKey
);
},
updateStore() {
const data = {
dataKey: this.customForm.dataKey,
......@@ -266,10 +268,21 @@ export default {
};
this.$store.commit("feature_type/UPDATE_CUSTOM_FORM", data);
},
trimWhiteSpace(string) {
// TODO : supprimer les espaces pour chaque option au début et à la fin QUE à la validation
return string.replace(/\s*,\s*/gi, ",");
},
hasRegularCharacters(input) {
for (let char of input) {
if (!/[a-zA-Z0-9-_]/.test(char)) {
return false;
}
}
return true;
},
checkCustomForm() {
if (this.form.label.value === null) {
this.form.label.errors = ["Veuillez compléter ce champ."];
......@@ -278,6 +291,12 @@ export default {
this.form.name.errors = ["Veuillez compléter ce champ."];
this.form.label.errors = [];
return false;
} else if (!this.hasRegularCharacters(this.form.name.value)) {
this.form.name.errors = [
"Veuillez utiliser seulement les caratères autorisés.",
];
this.form.label.errors = [];
return false;
}
this.form.label.errors = [];
this.form.name.errors = [];
......
......
......@@ -154,7 +154,6 @@
Créer et importer le(s) signalement(s) du geojson
</button>
<!-- // TODO: Add check script for form & other scripts // -->
</form>
</div>
</div>
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment