Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

add success redirect on go pages forms (#43105)

Alan Danielfe4f1b6e828d
diff --git a/packages/marketing/src/go/schemas.ts b/packages/marketing/src/go/schemas.ts
index 5c879877f78..540adff4efd 100644
--- a/packages/marketing/src/go/schemas.ts
+++ b/packages/marketing/src/go/schemas.ts
@@ -184,6 +184,8 @@ export const formSectionSchema = z.object({
disclaimer: z.string().optional(),
/** Message shown after a successful submission. Defaults to a generic thank-you message. */
successMessage: z.string().optional(),
+ /** URL to redirect the user to after a successful submission. When set, overrides successMessage. */
+ successRedirect: z.string().optional(),
/** CRM integration config. When provided, form submissions are sent to the configured providers. */
crm: formCrmConfigSchema.optional(),
})
diff --git a/packages/marketing/src/go/sections/FormSection.tsx b/packages/marketing/src/go/sections/FormSection.tsx
index ba566d67998..8442d418256 100644
--- a/packages/marketing/src/go/sections/FormSection.tsx
+++ b/packages/marketing/src/go/sections/FormSection.tsx
@@ -102,7 +102,11 @@ export default function FormSection({ section }: { section: GoFormSection }) {
const result = await submitFormAction(section.crm, values, { pageUri, pageName })
if (result.success) {
- setSubmitState('success')
+ if (section.successRedirect) {
+ window.location.href = section.successRedirect
+ } else {
+ setSubmitState('success')
+ }
} else {
setSubmitState('error')
setErrorMessages(result.errors)