# How to do a normal redirect from turbostream request?

**URL:** <https://discuss.hotwired.dev/t/how-to-do-a-normal-redirect-from-turbostream-request/3430>\
**Category:** General\
**Created:** [October 30, 2021, 4:28am UTC](https://discuss.hotwired.dev/t/how-to-do-a-normal-redirect-from-turbostream-request/3430 "2021-10-30T04:28:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![WriterZephos](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/writerzephos/32/2192_2.png) [@WriterZephos](https://discuss.hotwired.dev/u/WriterZephos)\
**Post date:** [October 30, 2021, 4:28am UTC](https://discuss.hotwired.dev/t/how-to-do-a-normal-redirect-from-turbostream-request/3430/1 "2021-10-30T04:28:19Z")

</div>

I have a new user form, which renders with a different layout than the normal user show view. I need to either redirect or somehow swap out the full page on the form submission, but I want to keep the turbostream functionality for rendering errors.

So far, redirecting to show fails to render the layout and fails to update the page.

Is there a standard way to do this?

Thank!

---

<div class="post-metadata">

**Author:** ![yunggindigo](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/yunggindigo/32/1271_2.png) [@yunggindigo](https://discuss.hotwired.dev/u/yunggindigo)\
**Post date:** [October 30, 2021, 1:39pm UTC](https://discuss.hotwired.dev/t/how-to-do-a-normal-redirect-from-turbostream-request/3430/2 "2021-10-30T13:39:59Z")

</div>

If this form is inside of a turbo-frame you can set the target attribute to  
“\_top” this means anything inside would navigate the whole page than when you redirect it should navigate the whole page.

---

<div class="post-metadata">

**Author:** ![WriterZephos](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/writerzephos/32/2192_2.png) [@WriterZephos](https://discuss.hotwired.dev/u/WriterZephos)\
**Post date:** [October 31, 2021, 4:13am UTC](https://discuss.hotwired.dev/t/how-to-do-a-normal-redirect-from-turbostream-request/3430/3 "2021-10-31T04:13:02Z")

</div>

Wouldn’t that break the normal behavior for when errors are returned? Also, I can’t get any views to be rendered with the full layout.

---

<div class="post-metadata">

**Author:** ![yunggindigo](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/yunggindigo/32/1271_2.png) [@yunggindigo](https://discuss.hotwired.dev/u/yunggindigo)\
**Post date:** [November 1, 2021, 10:28pm UTC](https://discuss.hotwired.dev/t/how-to-do-a-normal-redirect-from-turbostream-request/3430/4 "2021-11-01T22:28:02Z")

</div>

For the errors to still be rendered without leaving the page you could use a turbo\_stream response from the controller to replace the form. about the views not being rendered with the layout I’m not sure, where is it happening exactly?

---

<div class="post-metadata">

**Author:** ![archonic](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/archonic/32/2294_2.png) [@archonic](https://discuss.hotwired.dev/u/archonic)\
**Post date:** [November 4, 2021, 12:40am UTC](https://discuss.hotwired.dev/t/how-to-do-a-normal-redirect-from-turbostream-request/3430/5 "2021-11-04T00:40:22Z")

</div>

Using target `_top` indeed ruins the benefit of putting the form in a `turbo_frame`. Personally I’ve found that it also just doesn’t work with redirect responses and I’m confused as to why I keep seeing it recommended.

There’s a bunch of posts expressing confusion about this exact issue. See:

1. [Turbo and form redirects (again!)](https://discuss.hotwired.dev/t/turbo-and-form-redirects-again/3300)
2. [Form redirects not working as expected](https://discuss.hotwired.dev/t/form-redirects-not-working-as-expected/2058/)
3. [Break out of a frame during form redirect - #6 by adamsestra](https://discuss.hotwired.dev/t/break-out-of-a-frame-during-form-redirect/1562/6)
4. [Redirect to new page on successful form submission, rerender otherwise · Issue #138 · hotwired/turbo · GitHub](https://github.com/hotwired/turbo/issues/138#issuecomment-944973592)

The form replacement is great for errors, but when the form succeeds and gets a redirect response, Turbo, by design, doesn’t follow it. Confusing, right?

My recommendation is to disable Turbo on any form that has a redirect response. Seems crazy but [the alternative of using a hack](https://github.com/hotwired/turbo/issues/138#issuecomment-944711809) to call `Turbo.visit` after Turbo doesn’t render the redirect is worse IMO. The only forms where I have Turbo enabled are ones where the success response can just replace the form with a success message. For example when the user has to go click a confirm link in their email.
