Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turbo Frame on post submit not updating with _top #901

Closed
jonsgreen opened this issue Mar 29, 2023 · 2 comments · Fixed by #1038
Closed

Turbo Frame on post submit not updating with _top #901

jonsgreen opened this issue Mar 29, 2023 · 2 comments · Fixed by #1038

Comments

@jonsgreen
Copy link

I am not sure if this is a bug or expected behavior but I have found that if I submit a form with data-turbo-frame="_top" that the page does not seem to update while if I set it to a target with an id then it will update the matching frame.

It could easily be that I am doing something incorrect but I thought I would first ask whether this is an expected limitation with form submits.

seanpdoyle added a commit to seanpdoyle/turbo that referenced this issue Oct 12, 2023
Closes [hotwired#901][]

Add test coverage for submitting `<form>` elements with
`[data-turbo-frame="_top"]`. Coverage includes both `<form>` elements
outside of `<turbo-frame>` *and* `<form>` elements that are descendants
of `<turbo-frame>` elements.

[hotwired#901]: hotwired#901
@seanpdoyle
Copy link
Contributor

Thank you for opening this issue.

I've opened #1038. I did my best to faithfully reproduce the behavior you're describing here.

Unfortunately, I wasn't able to reproduce it. Submitting <form> elements with [data-turbo-frame="_top"] from inside and outside <turbo-frame> elements appeared to behave as expected.

I'd really appreciate feedback on #1038, particularly the structural changes to the form.html fixture. Do they recreate HTML similar to yours?

afcapel pushed a commit that referenced this issue Oct 23, 2023
Closes [#901][]

Add test coverage for submitting `<form>` elements with
`[data-turbo-frame="_top"]`. Coverage includes both `<form>` elements
outside of `<turbo-frame>` *and* `<form>` elements that are descendants
of `<turbo-frame>` elements.

[#901]: #901
@fluxsaas
Copy link

fluxsaas commented Oct 15, 2024

@jonsgreen @seanpdoyle

i know this is long been closed, but i stumbled into the same situation, i could track this down to following:

  • having a rails controller for Comment
  • after POST to create a Comment, redirect to another resource e.g. comment.commentable

this works (but without the desired outcome):

format.html { redirect_to comment, notice: 'Comment have been successfully created.' }

this does not work:

format.html { redirect_to comment.commentable, notice: 'Comment have been successfully created.' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants