Questions tagged [stimulusjs]
For questions regarding the Stimulus Javascript framework
stimulusjs
416
questions
1
vote
0
answers
25
views
How to preserve the original document's head tag when navigating in a turbo frame with `data-turbo-action='advance'`
The Problem:
I have a component that performs navigation using a turbo frame. I would like to reflect the navigation changes in the window URL for better UX.
According to the Turbo documentation, ...
0
votes
0
answers
32
views
Ruby on Rails: File field with stimulus controller breaks when uploading a second file
I have this file field:
<div data-controller="file-upload">
<%= file_field_tag "revision_photos[photo][]",
name: &...
0
votes
0
answers
77
views
Symfony 7.1 fresh install with asset mapper / stimulus bundle gives "@hotwired/stimulus was a bare specifier" when rendering page
I am installing a new Symfony 7.1 / PHP 8.3.8 app with asset mapper and stimulus bundle and I am encountering issues with making stimulus functional :
symfony new my_project_directory --version="...
1
vote
0
answers
30
views
How do I populate intl-tel-input fields with turbo_stream?
I already have the number saved in my database, using a turbo_stream file and using the turbo_power library I need to change the empty value to the number I have in my database (example: +...
0
votes
1
answer
37
views
Rails Turbo + Stimulus can't get FrameElement [solved]
I have a stimulus controller and a turbo frame. Based on the documentation, I should be able to reload the frame since it is part of the FrameElement API.
Every on change event has the following error:...
0
votes
1
answer
49
views
Turbo rails broadcast_refresh_to does not connect to stimulus controller
Using turbo 8.0.4.
Blog model:
after_update_commit lambda { |blog| }
broadcast_refresh_to blog
}
In blogs/show.html.erb
<%= turbo_stream_from @blog %>
<%= tag.div data: {controller: &...
0
votes
2
answers
139
views
Why am I getting a CSRF token authenticity error when trying to submit a form_with through my stimulus controller?
I connected a form_with with my stimulus controller, then added the form itself as a target and added an action to point to my stimulus controller's submit function. When I then get the form and try ...
0
votes
1
answer
42
views
Heroku router error ActionController::RoutingError (No route matches [GET] "/assets/modules/seat_builder.js")
The error that I am getting, in the Heroku server logs is this:
ActionController::RoutingError (No route matches [GET] "/assets/modules/seat_builder.js")
This error is popping up for every ...
1
vote
1
answer
53
views
Enable/disable editable field based on another editable field value in the grid
In my Rails 7 application, I have a Stimulus JS controller that uses AG-Grid to create a table. Each row in the table has an edit button, allowing editing of EDITABLE_FIELDS which are:
const ...
1
vote
0
answers
138
views
Remove all previous selected options in Tom Select configured with external data
I have two Tom Select (select inputs) configured through Symfony UX Autocomplete and Stimulus :
First holds the main category ("Batterie démarrage moto" in the example).
Second one is ...
1
vote
1
answer
201
views
Understanding StimulusJS connect() vs initialize() in context of turbo/hotwire
The Stimulus handbook describes the difference between connect/initialize as:
initialize(): Invoked only once, when the controller is first instantiated
connect(): Invoked anytime the controller is ...
0
votes
2
answers
105
views
How execute js code in rails 7 'create.turbo_stream.erb' file
here is my comment controller code
def create
@comment = current_user.comments.new(comment_params)
@feed = Feed.find(params[:comment][:feed_id])
@comment.commentable = @feed
@...
2
votes
2
answers
59
views
Change the class display after selecting a card with a date in Rails
I'm developing an application for a horsemanship school so they can organize their classes and see who booked a class and whatnot!
In the display of all the classes, I've created to help users choose ...
-1
votes
1
answer
40
views
Prevent an infinite loop while dispatching JavaScript events calling each other
I have a JavaScript Stimulus "controller" (I don't believe the framework matters here) attached to three different nodes:
<div id="foo" data-controller="scanner">&...
0
votes
0
answers
80
views
Error: SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON checkout. Using stimulus on Ruby on Rails
basically I'm using stimulusjs in ruby on rails to create an ecommerce, and I'm trying to assign the stripe to my application (remembering that the functionality is on the cart page), but basically ...