提交表格而无需更换带有涡轮的铁轨中的URL
我有一条轨道表格,
= form_with url: submit_path, multipart: true, data: { turbo_frame: 'document_table_content' } do |f|
Form-row
= f.submit t('.submit'), class: 'Button'
当我提交表格上的URL更改为submis_path
时,我想将其成功提交,我想保持URL相同,这是可能的吗?
I have a rails form that I successfully submit with turbo
= form_with url: submit_path, multipart: true, data: { turbo_frame: 'document_table_content' } do |f|
Form-row
= f.submit t('.submit'), class: 'Button'
When I submit the form the url changes to submit_path
, I want to keep the url the same, is that possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然可以。 turbo表单提交仅接受
重定向
或turbo_stream
在响应中。如果您想留在当前页面上,并且您确实不想在提交后执行任何更改,则在您的控制器中呈现这样的turbo_stream:但是,您可能需要使用以下代码来更新同一页面的部分:
注意该
turbo_stream
当前有7个操作:在此处阅读Of course you can. Turbo form submission only accepts
redirect
orturbo_stream
in response. If you want to stay on current page and you really don't want to perform any changes in it after submission, in your controller render a turbo_stream like this:However, you may want to update portion of the same page using following code:
Note that
turbo_stream
has currently 7 actions: Read here