nested frames with a form will not redirect
See original GitHub issueGiven I have a template that looks like this:
<%= turbo_frame_tag 'modal_thing' do %>
<%= turbo_frame_tag 'create_tag', target: '_top' do %>
<%= form_with url: '/bags/1', method: 'patch' do |form| %>
<input name="title">
<button type="submit">go</button>
<% end %>
<% end %>
<% end %>
And my server responds with a 302 redirect.
Then the page does not redirect on form submission and I see this error in the javascript console:
Response has no matching <turbo-frame id="modal_thing"> element turbo.es2017-esm.js:5181
_callee25$ turbo.es2017-esm.js:5181
Babel 8
_callee22$ turbo.es2017-esm.js:4906
Babel 10
formSubmissionSucceededWithResponse turbo.es2017-esm.js:5065
requestSucceededWithResponse turbo.es2017-esm.js:1048
_callee2$ turbo.es2017-esm.js:616
Babel 8
_callee$ turbo.es2017-esm.js:559
Babel 12
_callee4$ turbo.es2017-esm.js:972
Babel 8
formSubmissionIntercepted turbo.es2017-esm.js:4992
submitBubbled turbo.es2017-esm.js:1214
(Async: EventListener.handleEvent)
start turbo.es2017-esm.js:1226
connect turbo.es2017-esm.js:4785
connectedCallback turbo.es2017-esm.js:143
(Async: LifecycleConnectedCallback)
js turbo.es2017-esm.js:5621
Webpack 9
If I remove the outer containing turbo-frame, then it works as expected.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Form target be nested frame? - html - Stack Overflow
Purpose is to submit form's content(post) to php file, but the result to be loaded in this same file(if it would be a...
Read more >Response.redirect from a frameset. - MSDN - Microsoft
i want the entire frameset to be redirected. target="_top" within a link tag causes the new page to load in the full body...
Read more >Prevent redirects from breaking out of iframe | Community
When form A ends the redirect opens in the parent window and not within the iframe. The entire form sequence remains within the...
Read more >Redirect to new page on successful form submission ... - GitHub
I'm trying to figure out how to do this. Right now, when I submit a form from within a turbo_frame_tag , I'm reliant...
Read more >Solved: Redirecting a form on load - ServiceNow Community
This is not a problem except that It loads another set of frames nested within the existing frame - including another copy of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve been having exactly the same problem. I’ve tried applying
target="_top"
to the form, the inner frame, and the outer frame.If
target: '_top'
is applied to the inner frame and/or the form, the error refers to the outer frame as in the OP.If
target: '_top'
is applied to both frames and the form, the error readsResponse has no matching <turbo-frame id="\39 modal_thing"> element
.Thanks for the fix, @tleish and co.!