diff --git a/.changeset/yellow-lies-mix.md b/.changeset/yellow-lies-mix.md new file mode 100644 index 000000000..2ef189490 --- /dev/null +++ b/.changeset/yellow-lies-mix.md @@ -0,0 +1,5 @@ +--- +'@finsweet/attributes-formsubmit': patch +--- + +fix: respect Webflow's native form redirect settings diff --git a/packages/formsubmit/src/factory.ts b/packages/formsubmit/src/factory.ts index ebda3cf65..bca7b61b1 100644 --- a/packages/formsubmit/src/factory.ts +++ b/packages/formsubmit/src/factory.ts @@ -32,7 +32,7 @@ export const initFormInstance = (formElement: Element) => { const rawRedirect = getAttribute(formElement, 'redirect'); const [redirect, redirectTimeout] = parseActionAttribute(rawRedirect); - const redirectUrl = getAttribute(formElement, 'redirecturl'); + const redirectUrl = getAttribute(formElement, 'redirecturl') || form.getAttribute('redirect'); const redirectToNewTab = hasAttributeValue(formElement, 'redirectnewtab', 'true'); // Disable