@hortonstudio/main 1.7.4 → 1.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autoInit/form.js +14 -15
- package/index.js +1 -1
- package/package.json +1 -1
package/autoInit/form.js
CHANGED
|
@@ -651,26 +651,25 @@ export function init() {
|
|
|
651
651
|
finalAnimElement.click();
|
|
652
652
|
}
|
|
653
653
|
|
|
654
|
-
//
|
|
654
|
+
// Store redirect URL for after successful submission
|
|
655
655
|
if (formWrapper && formWrapper.hasAttribute('data-hs-form-redirect')) {
|
|
656
656
|
const redirectUrl = formWrapper.getAttribute('data-hs-form-redirect');
|
|
657
657
|
|
|
658
658
|
if (redirectUrl && redirectUrl.trim()) {
|
|
659
|
-
//
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
form.submit();
|
|
671
|
-
}
|
|
659
|
+
// Set up redirect after form submission completes
|
|
660
|
+
const handleFormSubmissionComplete = () => {
|
|
661
|
+
// Minimal delay to ensure form submission is processed
|
|
662
|
+
setTimeout(() => {
|
|
663
|
+
try {
|
|
664
|
+
window.location.href = redirectUrl.trim();
|
|
665
|
+
} catch (error) {
|
|
666
|
+
console.error('Form redirect failed:', error);
|
|
667
|
+
}
|
|
668
|
+
}, 1);
|
|
669
|
+
};
|
|
672
670
|
|
|
673
|
-
|
|
671
|
+
// Listen for when the form submission completes
|
|
672
|
+
form.addEventListener('submit', handleFormSubmissionComplete, { once: true });
|
|
674
673
|
}
|
|
675
674
|
}
|
|
676
675
|
|
package/index.js
CHANGED