Frame navigation that targets a specific frame via form_with

13949
0

Sometimes a form submission should update a specific section rather than navigate the whole page. With Turbo, this is as easy as setting data-turbo-frame on the form. For example, a filter form can target a results frame, so submissions replace only that region. This pattern works especially well with GET forms because you keep URLs and shareability. I also use it for “inline create” forms that should append to a list frame. The key is consistency: the response should contain the same frame id. If you return full HTML without that frame, Turbo will treat it as a full visit. I typically pair this with a respond_to that returns both HTML and turbo stream versions depending on what’s most convenient.