Jake Vanderwerf
10 days ago 97e7c319d656a5f05489ca996e249e7359303d4d
src/forms/view.js
@@ -13,9 +13,9 @@
      document.querySelectorAll('.jvb-form-block form').forEach(form => {
         this.controller.registerForm(form, {
            autosave: true,
            cache: true,
            autoUpload: false,
            showSummary: true,
            imageMeta: false,
         });
      });
@@ -34,8 +34,6 @@
      // Add regular form fields
      for (const [key, value] of Object.entries(data)) {
         if (key === '_wpnonce' || key === '_wp_http_referer') continue;
         if (Array.isArray(value)) {
            value.forEach(v => submitData.append(`${key}[]`, v));
         } else if (typeof value === 'object' && value !== null) {
@@ -44,11 +42,15 @@
            submitData.append(key, value);
         }
      }
      config.element.querySelectorAll('[name="form_id"],[name="form_type"],[name="timestamp"],[name="cf-turnstile-response"]').forEach(input => {
         submitData.append(input.name, input.value);
      });
      // Add uploaded files
      if (window.jvbUploads) {
         try {
            const files = await window.jvbUploads.getFilesForForm(form);
            files.forEach(({ file, fieldName }) => {
               submitData.append(`${fieldName}[]`, file);
            });
@@ -75,7 +77,9 @@
         }
         this.controller.showFormStatus(config.id, 'submitted');
         this.controller.showSummary(config.id, '.jvb-form-block');
         // this.controller.handleFormSuccess(form, result);
         this.controller.showSummary({ changes: data, config: config });
         window.jvbA11y.announce('Form successfully submitted!');
         // Clean up uploaded files
         if (window.jvbUploads) {