feat: Regulären Ausdruck zur Überprüfung der Stadt im Frontend hinzugefügt.
This commit is contained in:
parent
fe1d553a8d
commit
7d582d2422
@ -119,5 +119,17 @@
|
|||||||
"AddedWho": "DDEnvelopGenerator",
|
"AddedWho": "DDEnvelopGenerator",
|
||||||
"ReminderTypeId": 202377,
|
"ReminderTypeId": 202377,
|
||||||
"EmailAttmt1": ""
|
"EmailAttmt1": ""
|
||||||
}
|
},
|
||||||
|
"Regexes": [
|
||||||
|
{
|
||||||
|
"Pattern": "/^\\p{L}+(?:([\\ \\-\\']|(\\.\\ ))\\p{L}+)*$/u",
|
||||||
|
"Name": "City",
|
||||||
|
"Platforms": [ ".NET" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Pattern": "/^[a-zA-Z\\u0080-\\u024F]+(?:([\\ \\-\\']|(\\.\\ ))[a-zA-Z\\u0080-\\u024F]+)*$/",
|
||||||
|
"Name": "City",
|
||||||
|
"Platforms": [ "javascript" ]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@ -108,6 +108,8 @@
|
|||||||
|
|
||||||
this.markFieldAsRequired(formFieldCity);
|
this.markFieldAsRequired(formFieldCity);
|
||||||
|
|
||||||
|
this.markFieldAsCity(formFieldCity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date, post code and place label part
|
* Date, post code and place label part
|
||||||
*/
|
*/
|
||||||
@ -307,6 +309,7 @@
|
|||||||
return inch * 72
|
return inch * 72
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//required
|
||||||
static #requiredFieldNames = new Array()
|
static #requiredFieldNames = new Array()
|
||||||
|
|
||||||
static markFieldAsRequired(formField) {
|
static markFieldAsRequired(formField) {
|
||||||
@ -316,4 +319,15 @@
|
|||||||
static isFieldRequired(formField) {
|
static isFieldRequired(formField) {
|
||||||
return this.#requiredFieldNames.includes(formField.name)
|
return this.#requiredFieldNames.includes(formField.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//city
|
||||||
|
static #cityFieldNames = new Array()
|
||||||
|
|
||||||
|
static markFieldAsCity(formField) {
|
||||||
|
this.#cityFieldNames.push(formField.name)
|
||||||
|
}
|
||||||
|
|
||||||
|
static isCityField(formField){
|
||||||
|
return this.#cityFieldNames.includes(formField.name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -170,6 +170,8 @@ class App {
|
|||||||
async handleFinish(event) {
|
async handleFinish(event) {
|
||||||
const iJSON = await this.Instance.exportInstantJSON()
|
const iJSON = await this.Instance.exportInstantJSON()
|
||||||
const iFormFieldValues = await iJSON.formFieldValues;
|
const iFormFieldValues = await iJSON.formFieldValues;
|
||||||
|
|
||||||
|
//check required
|
||||||
const iReqFields = iFormFieldValues.filter(f => Annotation.isFieldRequired(f))
|
const iReqFields = iFormFieldValues.filter(f => Annotation.isFieldRequired(f))
|
||||||
const hasEmptyReq = iReqFields.some(f => (f.value === undefined || f.value === null || f.value === ""))
|
const hasEmptyReq = iReqFields.some(f => (f.value === undefined || f.value === null || f.value === ""))
|
||||||
|
|
||||||
@ -182,6 +184,20 @@ class App {
|
|||||||
return false;
|
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)
|
const validationResult = await this.validateAnnotations(this.signatureCount)
|
||||||
if (validationResult === false) {
|
if (validationResult === false) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user