# Turbo frame content not replaced

**URL:** <https://discuss.hotwired.dev/t/turbo-frame-content-not-replaced/2246>\
**Category:** General\
**Created:** [February 6, 2021, 4:46pm UTC](https://discuss.hotwired.dev/t/turbo-frame-content-not-replaced/2246 "2021-02-06T16:46:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kldtz](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/kldtz/32/1612_2.png) [@kldtz](https://discuss.hotwired.dev/u/kldtz)\
**Post date:** [February 6, 2021, 4:46pm UTC](https://discuss.hotwired.dev/t/turbo-frame-content-not-replaced/2246/1 "2021-02-06T16:46:52Z")

</div>

I’m trying to make the basic frame example from the handbook work, unfortunately without success so far. Probably some very obvious mistake on my side, but nothing I tried worked so far and I couldn’t find the solution in any existing discussion.

This is my initial page:

```
<html>
<head>
    <script type="module">
        import hotwiredTurbo from 'https://cdn.skypack.dev/@hotwired/turbo';
    </script>
    <title>Example</title>
</head>

<body>    
<h1>Index page</h1>

<turbo-frame id="message_1">
    <h1>My message title</h1>
    <p>My message content</p>
    <a href="/messages/edit/1">Edit this message</a>
</turbo-frame>

</body>
</html>

```

After clicking the link, Turbo is fetching the following content in the background, as expected:

```
<body>    

<h1>Editing message 1</h1>

<turbo-frame id="message_1">
    <form action="/messages/1">
        <input name="message[name]" type="text" value="My message title">
        <textarea name="message[name]">My message content</textarea>
        <input type="submit">
    </form>
</turbo-frame>

</body>

```

However, the initial page remains unchanged, the content is not replaced. The ID of the frame in the response matches the ID of the frame that contains the link. What am I missing?

---

<div class="post-metadata">

**Author:** ![minimul](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/minimul/32/1505_2.png) [@minimul](https://discuss.hotwired.dev/u/minimul)\
**Post date:** [February 8, 2021, 1:29pm UTC](https://discuss.hotwired.dev/t/turbo-frame-content-not-replaced/2246/2 "2021-02-08T13:29:47Z")

</div>

Share also the backend code.

---

<div class="post-metadata">

**Author:** ![kldtz](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/kldtz/32/1612_2.png) [@kldtz](https://discuss.hotwired.dev/u/kldtz)\
**Post date:** [February 8, 2021, 3:09pm UTC](https://discuss.hotwired.dev/t/turbo-frame-content-not-replaced/2246/3 "2021-02-08T15:09:49Z")

</div>

I use a simple Rust back end that serves the HTML above, here is a minimal example: [https://github.com/kldtz/turbo-example](https://github.com/kldtz/turbo-example). The way I understood the documentation, I don’t need to do anything special in the back end to make turbo-frames work (as opposed to turbo-streams), but maybe I’m wrong? Thanks for your help!

---

<div class="post-metadata">

**Author:** ![minimul](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/minimul/32/1505_2.png) [@minimul](https://discuss.hotwired.dev/u/minimul)\
**Post date:** [February 8, 2021, 3:38pm UTC](https://discuss.hotwired.dev/t/turbo-frame-content-not-replaced/2246/4 "2021-02-08T15:38:36Z")

</div>

A form submission when successful is expected to redirect. If there is a form error then you need to return a status code 4xx or 5xx in the response. It looks like you’re just returning a 200.

---

<div class="post-metadata">

**Author:** ![kldtz](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/kldtz/32/1612_2.png) [@kldtz](https://discuss.hotwired.dev/u/kldtz)\
**Post date:** [February 8, 2021, 5:03pm UTC](https://discuss.hotwired.dev/t/turbo-frame-content-not-replaced/2246/5 "2021-02-08T17:03:23Z")

</div>

Thanks for your response! I actually didn’t submit a form, but followed a link.

I found my (dumb) error after implementing the same minimal example with Rails and comparing the requests: I forgot to set the content type to text/html, now it works. Sorry for the unnecessary question.
