Skip to main content

Dynamic Nested Forms with Stimulus JS Discussion

General • Asked by Chris Oliver

Yes this is what ive been waiting for!


Great, I like your screencasts about Stimulus a lot!


That's a great one!

I'd suggest using <button type="button"> elements instead of links. This way you don't have to use event.preventDefault() because by default a button doesn't do anything.

Also, for both links and buttons, the default Stimulus action is click so the click-> part in the data-action is optional.


Great episode !
I use cocoon often in my invoicing apps projects to allow people to add items into a bill.
Next, I'll give stimulus way definetly a chance !


Well done! Keep the Stimulus JS tutorials coming!

I wonder if there is a tutorial you could assemble where we'd see Turbolinks and Stimulus working together, to provide some context around why Basecamp promotes them.

Even cooler would be a use case where someone today is typically reaching for Rails with React, but instead having the tutorial depicting how the Rails/Turbolinks/Stimulus combo would solve the same use case.

Thanks!


Great episode Chris! Totally bypassed an entire gem.


Keep the stimulus stuff coming!


This is really great stuff. Stimulus with rails just completes the toolkit so nicely.


How do you display the Tasks in the Project Index and Show Views?

Nevermind, got it working.


Great episode, I've been using Cocoon in past projects to add a "content section block" to a page, which then has different types of content associated to it (ie textarea, text with image, image gallery, etc.), so that it can then be reordered if needed.

I'd like to use more Stimulus moving forward, so interested in trying this technique out.

One part that I could never quite suss out, was when adding a content section block with a file auto uploader, such as jQuery File Upload (for multiple images/or documents) I couldn't upload anything until the content section block was saved to the database via a page save.

I guess with Stimulus, a new nested field could be saved to the database within the Stimulus controller, when it's added to the form? Then there would be an ID to use for any files to upload against.

Saying that, with a move away from jQuery, would Stimulus be able to deal with file uploads in a simular way to jQuery File Upload or is it best to leave that sort of thing to ActiveStorage?


Hey there! first comment here, trying to follow up the tutorial but missing the template.rb file you're using to start the project... i'm quite sure missing something basic :)

can someone help?

thanks!

you can find it here: https://github.com/excid3/jumpstart. See readme for instructions.

But frankly, I don't like using this template. In more than a few tutorials that this template is used, I encounted bugs that only slowed down the progress of following through the tutorial, instead of helping it.

Because the jumpstart script is constantly updated, older tutorials using it see a breakage.

then what way you'd suggest to follow up tutorials? cloning the project?
thx!


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 20,000+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.