feat: Regulären Ausdruck zur Überprüfung der Stadt im Frontend hinzugefügt.

This commit is contained in:
Developer 02
2024-07-18 14:13:33 +02:00
parent fe1d553a8d
commit 7d582d2422
3 changed files with 43 additions and 1 deletions

View File

@@ -170,6 +170,8 @@ class App {
async handleFinish(event) {
const iJSON = await this.Instance.exportInstantJSON()
const iFormFieldValues = await iJSON.formFieldValues;
//check required
const iReqFields = iFormFieldValues.filter(f => Annotation.isFieldRequired(f))
const hasEmptyReq = iReqFields.some(f => (f.value === undefined || f.value === null || f.value === ""))
@@ -182,6 +184,20 @@ class App {
return false;
}
//check city
const city_regex = new RegExp("^[a-zA-Z\\u0080-\\u024F]+(?:([\\ \\-\\']|(\\.\\ ))[a-zA-Z\\u0080-\\u024F]+)*$")
const iCityFields = iFormFieldValues.filter(f => Annotation.isCityField(f))
for(var f of iCityFields)
if(!city_regex.test(f.value)){
Swal.fire({
title: 'Warnung',
text: `Bitte überprüfen Sie die eingegebene Ortsangabe "${f.value}" auf korrekte Formatierung. Beispiele für richtige Formate sind: München, Île-de-France, Sauðárkrókur, San Francisco, St. Catharines usw.`,
icon: 'warning',
})
return false;
}
//check # of signature
const validationResult = await this.validateAnnotations(this.signatureCount)
if (validationResult === false) {
Swal.fire({