Questions tagged [hotwire-rails]

Hotwire-rails is a collection of front-end tools for Rails available since Rails 6 and enabled by default in Rails 7. Use the [Hotwire-rails] tag for questions about Stimulus, Turbo Drive, Turbo Frames and Turbo Streams and especially their usage in Rails. This tag is not for turbo-links (unless the question is about updating to Hotwire). Also be aware that Hotwire and its components are sometimes used outside of Rails.

See also:

228 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
14
votes
1 answer

Rails 7 Dynamic Nested Forms with hotwire/turbo frames

I'm very new to Rails. I've started right from Rails 7 so there is still very little information regarding my problem. Here is what I have: app/models/cocktail.rb class Cocktail < ApplicationRecord has_many :cocktail_ingredients, dependent:…
zdebyman
  • 550
  • 1
  • 4
  • 22
9
votes
1 answer

Broadcast to a User's Turbo Stream using Hotwire Rails

I want to stream model updates using Hotwire in Rails. In the documentation they mention creating a stream using a model but I want to create a dynamic stream per user so that changes to models done by a user are only streamed to that user. I have a…
Encore PTL
  • 8,084
  • 10
  • 43
  • 78
8
votes
3 answers

Getting a Turbo Frame Error of "Content Missing"

I'm trying to use turbo_frame_tag in my Rails application to manage some tasks. I created a scaffold for my tasks. I wrapped the page I want to use inside of a turbo frame tag as below: <%= turbo_frame_tag "modal" do %>

New task

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

ActionController::UnknownFormat when using format.turbo_stream in Rails 7

Hey I'm new to turbo_streams and am stuck on why I'm getting this error. Properties partial:
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
7
votes
3 answers

How to display Devise login form errors when using Hotwire Rails

I've followed this GoRails video to get Devise working with hotwire-rails. I'm at a loss as to why my login error messages do not work the same way as in the video. The error messages work great on the registration form but on the login form I get…
Lee McAlilly
  • 9,084
  • 12
  • 60
  • 94
6
votes
2 answers

Adding a Stimulus click action to a Turbo link?

I am doing an inline editing feature on the show page with the 'Edit' button above the frame that loads with turbo. Trying to add a toggle on the edit button that it switches to the cancel button in edit mode. Figured a simple stimulus controller…
Dan Tappin
  • 2,692
  • 3
  • 37
  • 77
6
votes
3 answers

Turbolinks to Turbo upgrade has broken form redirection

I'm attempting to upgrade to Turbo from Turbolinks and I've found that the client is not rendering redirects for form submissions. Versions: rails 6.1.4 hotwire-rails 0.1.2 @hotwired/turbo-rails 7.0.0-beta.8 I've ignored the incompatibility…
Archonic
  • 5,207
  • 5
  • 39
  • 55
6
votes
5 answers

Hotwire breaks link_to rails

I recently added Hotwire to my rails app to update modals but this broke a link_to I had that redirected users to stripe. I looked online for ways to work around it but since Hotwire is relatively new, I couldn't find it. Does anyone have any…
5
votes
1 answer

Stimulus JS Controllers not connecting to Rails App

I'm working on a Rails 7.0.2 App with Ruby 3.0.2 and I'm following the stimulus tutorial for making a clipboard copy button https://stimulus.hotwired.dev/handbook/hello-stimulus .When I press the button nothings happened and I've over ridden my…
CJG
  • 457
  • 2
  • 17
5
votes
2 answers

How to import Tailwind plugin in Rails 7

I'm trying to use npm package 'tailwindcss-flip' in my Rails 7 app. The package docs have the following instructions: Install tailwindcss-flip package: Install using NPM npm install tailwindcss-flip --save-dev Install using Yarn yarn add…
1
2 3
15 16