feat: Developed markFieldAsRequired and isFieldRequired methods to mark and validate required form fields; added user alert if location information is not provided.
This commit is contained in:
@@ -65,7 +65,7 @@ class App {
|
||||
|
||||
this.Instance.addEventListener("annotations.willChange", _ => {
|
||||
Comp.ActPanel.Toggle();
|
||||
});
|
||||
});
|
||||
|
||||
// Load annotations into PSPDFKit
|
||||
try {
|
||||
@@ -168,6 +168,20 @@ class App {
|
||||
}
|
||||
|
||||
async handleFinish(event) {
|
||||
const iJSON = await this.Instance.exportInstantJSON()
|
||||
const iFormFieldValues = await iJSON.formFieldValues;
|
||||
const iReqFields = iFormFieldValues.filter(f => Annotation.isFieldRequired(f))
|
||||
const hasEmptyReq = iReqFields.some(f => (f.value === undefined || f.value === null || f.value === ""))
|
||||
|
||||
if (hasEmptyReq){
|
||||
Swal.fire({
|
||||
title: 'Warnung',
|
||||
text: 'Bitte füllen Sie alle Standortinformationen vollständig aus!',
|
||||
icon: 'warning',
|
||||
})
|
||||
return false;
|
||||
}
|
||||
|
||||
const validationResult = await this.validateAnnotations(this.signatureCount)
|
||||
if (validationResult === false) {
|
||||
Swal.fire({
|
||||
@@ -204,7 +218,7 @@ class App {
|
||||
|
||||
// Export annotation data and save to database
|
||||
try {
|
||||
const json = await this.Instance.exportInstantJSON()
|
||||
const json = await iJSON
|
||||
const postEnvelopeResult = await this.Network.postEnvelope(
|
||||
this.envelopeKey,
|
||||
this.currentDocument.id,
|
||||
|
||||
Reference in New Issue
Block a user