Umbraco Forms redirect not working on "redirectToPageId"

Hello Umbraco folk,

I’ve been looking at allowing the user to change the redirect page for a form with a content picker on a page (defaulting back to the redirect set on the form if not set).

I found the field redirectToPageId to which I can pass a GUID in of the page (as explained in the docs). Unfortunately, I can’t get this to work - it always redirects the user to the redirect set in the default form workflow.

I’m rendering using the component like so:

@await Component.InvokeAsync(“RenderForm”, new { formId = config.FooterForm, theme = “custom”, redirectToPageId = redirectPage.Value })

Where redirectPage is a Guid? driven by a content picker. I’ve tried passing in a GUID and an integer - neither work. I also tried the redirectUrl param (just in case!)

Have I found a bug here or am I doing something daft?

Thanks!

Hey @Rockerby!

I have just tried this in v13, v16 and v17 versions and I’m seeing the correct functionality when passing a GUID… :thinking:

What version are you using? And are you setting any other redirects with a FormsRedirectAfterFormSubmitUrl item in the HttpContext? (as documented here Extending | Umbraco Forms )

Morning @rickbutterfield - thanks for the response!

School-boy error forgetting to add the versions. I’m running Umbraco 13.11.0 with Forms 13.7.0 (initially tested on 13.6 but upgraded to 13.7).

I’m not setting the variable in the context, but if you’re getting this to work in a bare bone setup I’ll start from there and do some more digging.

Sharing my resolution, should anyone else find themselves in a similar position!

I had a custom theme for the form and I was missing the hidden field for the redirect from my Render.cshtml … No idea where it went, but popping this back in did the trick.

@Html.HiddenFor(x => Model.RedirectToPageId, new { id = (string?)null })