Questions tagged [turbo]

201 questions
20
votes
2 answers

How can I submit a form on input change with Turbo Streams?

I have a form I want to submit automatically whenever any input field is changed. I am using Turbo Streams, and if I use onchange: "this.form.submit()" it isn't captured by Turbo Streams and Rails uses a standard HTML response. It works fine when…
tsvallender
  • 2,615
  • 6
  • 32
  • 42
20
votes
4 answers

What's the hotwire way of dealing with data-disable-with?

I'm starting to use Hotwire in my Rails app and I implemented something similar to the tutorial video where a form gets submitted and refresh another part of the page. Like in the video, I had to implement my own reset form controller: import…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
16
votes
1 answer

Hotwire Turbo does not replace turbo-frame, throws warning: Response has no matching element

I'm getting started with Hotwire and Turbo in Rails 6 and have an issue with Turbo not replacing my turbo-frame. I'm receiving the following error message: Response has no matching element. I have the following being…
Matt
  • 5,800
  • 1
  • 44
  • 40
12
votes
2 answers

Rails - Turbo - link preload but not used within a few seconds from the window's load event

This is a common question on the web but I didn't found any solution for my problem... I have the same warning message in console on all my rails apps when I click on a link to an other page Just need to find THE solution now... The resource…
Loris_R
  • 123
  • 1
  • 6
11
votes
8 answers

Link to turbo frame not working, navigating full page instead

I have the following code: <%= turbo_frame_tag :my_frame do %> frame <% end %> <%= link_to "About", about_path, data: { turbo_frame: :my_frame } %> When I click the "About" link, the frame's content doesn't get updated. Instead, the whole page…
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
11
votes
5 answers

How to call confirm prompt using button_to in Rails with Turbo

Previously in Rails when using the button_to tag, it was possible to use a confirmation dialog like this <%= button_to 'Destroy', @post, method: :delete, data: { confirm: 'Are you sure?' } %> data: { confirm: 'Are you sure?' } is Rails magic data…
mechnicov
  • 12,025
  • 4
  • 33
  • 56
9
votes
5 answers

How can I disable Hotwire / Turbo (the Turbolinks replacement) for all forms in a Rails application?

In Rails 7, Turbolinks is replaced by Hotwire / Turbo. This patches up web links so that they become AJAX-style requests just like Turbolinks did, but also patches up forms. On the whole, we found this broke swathes of our application. Forms that…
Andrew Hodgkinson
  • 4,379
  • 3
  • 33
  • 43
9
votes
4 answers

Why is Turbo not honoring link_to method: :post?

For a long time, Rails has provided a method: :post option in the link_to helper: when the option was given, Rails would intercept the click and issue a POST request, instead of the default GET request. However, for some unknown reason, this is not…
Rodrigo Serrano
  • 1,425
  • 1
  • 11
  • 13
8
votes
1 answer

How can I execute JavaScript when a new Turbo Frame is loaded

I am using Turbo Frames in my Rails app and have, on every page This loads in fine, and when a link is clicked replaces the frame as expected. In this frame I have set overflow-y: scroll,…
tsvallender
  • 2,615
  • 6
  • 32
  • 42
7
votes
2 answers

GET request processed as HTML rather than TURBO_STREAM from within turbo_frame_tag

I am starting to work with hotwire/turbo and have set everything up. Turbo streams are working correctly. Within index.html.erb:

Tasks

<%= turbo_stream_from "tasks" %>
<% @tasks.each do |task| %> <%= render task %> …
daveanderson88
  • 327
  • 1
  • 4
  • 12
6
votes
0 answers

Stimulus does not identify outlets in Rails 7 app

In a Rails 7 app, clicking an icon toggles the display property of a form. Both HTML elements connect properly to their respective controllers (toggler and togglee). The form (togglee) is an outlet of the icon (toggler). The problem: The toggler…
BEEK
  • 151
  • 2
  • 5
5
votes
2 answers

Rails Turbo doesn't trigger turbo:load event

The turbo:load event is not fired after a turbo visit (as the documentation says it should). It works as expected after the initial full-page load. I can catch the "turbo:before-fetch-response" event, but I have no luck with turbo:load, :render,…
BEEK
  • 151
  • 2
  • 5
4
votes
1 answer

How to have a delete link respond to turbo_stream and html in Rails 7?

I have a delete link in Rails 7 that functions correctly using either turbo_stream or html, but not each of those. link_to 'delete', @object, data: { turbo_method: 'delete', turbo_confirm: 'Really?' } I call this link from the index page, which…
hellion
  • 4,602
  • 6
  • 38
  • 77
4
votes
1 answer

Folder hierarchy in packages - Turbo/Monorepo

Many articles and tutorials teach how to share components in monorepo projects. But they show something in an unproductive way. Share each component (package1, package2) separately in workspace. What I intend to do is export a complete package…
rick
  • 554
  • 6
  • 18
4
votes
2 answers

Typing indicator with action cable in rails- 7

I am unable to add typing indicator in my rails app with action cable I have created app in rails 7 and I user trubo stream tag and broadcast in it so I did't used channel for live chat , I tried to find tutorial and video but there is not any I…
1
2 3
13 14