Jake Vanderwerf
2026-01-25 b38f03c0e7218762d90fa5092696b127f24f36db
assets/js/concise/FormController.js
@@ -378,11 +378,14 @@
      if (this.subscribers.size > 0) {
         e.preventDefault();
         console.log('Cancelling scheduled backup and manually backing up');
         if (form.options.cache) {
         this.cancelBackup();
         await this.backup();
         const storedData = await this.store.get(form.id);
         if (form.options.cache) {
            this.notify('form-submit', {
               config: form,
               data: storedData.changes
@@ -812,7 +815,8 @@
                        let index = config.ui.items?.children?.length??0;
                        el.dataset.index = index;
                        manyRefs.inputs?.forEach(input => {
                           window.prefixInput(input, `${el.dataset.fieldName}:${index}:`)
                           let wrapper = el.closest('[data-field]');
                           window.prefixInput(input, `${el.dataset.fieldName}:${index}:`, wrapper);
                        });
                     }
                  },
@@ -883,7 +887,8 @@
                        let index = config.ui.items?.children?.length??0;
                        el.dataset.index = index;
                        manyRefs.inputs?.forEach(input => {
                           window.prefixInput(input, `${el.dataset.fieldName}:${index}:`)
                           let wrapper = window.closest('.tag-item');
                           window.prefixInput(input, `${el.dataset.fieldName}:${index}:`, wrapper)
                        });
                        if (refs.label) {
@@ -1179,19 +1184,29 @@
    * @param {HTMLElement} container
    */
   reindexList(container) {
      const fieldName = container.dataset.field || container.dataset.repeaterId || container.dataset.tagListId;
      Array.from(container.children).forEach((item, index) => {
         item.dataset.index = `${index}`;
         Array.from(item.children).forEach(child => {
            if (child.type === 'hidden') {
               window.prefixInput(
                  child,
                  `${container.dataset.field}:${index}:${child.dataset.field}`
               );
            }
         });
      });
      //schedule save
         // Find ALL inputs within this item, not just direct children
         const inputs = item.querySelectorAll('input, select, textarea');
         inputs.forEach(input => {
            // Skip inputs that shouldn't be re-indexed (like file inputs)
            if (input.type === 'file') return;
            // Get the field name from the input's data-field or name
            const inputField = input.dataset.field || input.name.split(':').pop();
            // Re-prefix with the new index, passing item as wrapper
            window.prefixInput(
               input,
               `${fieldName}:${index}:`,
               item  // Pass the item as wrapper for label lookup
            );
         });
      });
   }
   /**********************************************************************
    VALIDATION