Hass PRO said about 1 year ago on Dynamic Select Forms with Hotwire :
Hi David, great episode. Can I just confirm with you which part of Turbo specifically requires Redis+ActionCable? 

I'd like to use turbo without the Redis+ActionCable dependency and the features that rely on them.

David Kimura PRO said about 1 year ago on Dynamic Select Forms with Hotwire :
  You should be able to use Turbo without Redis or ActionCable if you are not broadcasting on update, create or destroys. 

Raul Espinosa said 7 months ago on Dynamic Select Forms with Hotwire :
How do you handle errors if there is a validation? Thanks

etmartinkazoo said about 2 months ago on Dynamic Select Forms with Hotwire :
Great episode, thank you.

I cannot seem to get this working. It is throwing a:

Error invoking action "change->dynamic-select#updateProjects"

Error: Missing target element "secondarySelect" for "dynamic-select" controller

I am running the latest version of Rails and wondering if something has changed since you made this episode...?

David Kimura PRO said about 2 months ago on Dynamic Select Forms with Hotwire :
The episode should still be accurate. That error usually means that you're missing an element on the page with 
"data-dynamic-select-target": "secondarySelect"

etmartinkazoo said about 2 months ago on Dynamic Select Forms with Hotwire :
Woah, thanks for the quick response!

I do have that in place. My code is:
<div data-controller="dynamic-select" data-dynamic-select-url-value="<%= filtered_projects_organizations_path %>" data-dynamic-select-selected-value="<%= task.project_id %>"
    >
        <%= form.label :organization_id %>
        <%= form.select :organization_id,
          Organization.all.map { |o| [o.name, o.id] },
          { prompt: 'Please select an organization' },
          {
            "data-action": "change->dynamic-select#updateProjects",
            "data-dynamic-select-target": "mainSelect"
          }
        %>
      </div>
      <div>
        <%= form.label :project_id %>
        <%= form.select :project_id,
          [],
          { prompt: 'Please select a project' },
          {
            "data-dynamic-select-target": "secondarySelect"
          }
        %>
      </div>

David Kimura PRO said about 2 months ago on Dynamic Select Forms with Hotwire :
Can you inspect the html in the browser to make sure that the data attribute got set?

etmartinkazoo said about 2 months ago on Dynamic Select Forms with Hotwire :
It looks like it is set:

David Kimura PRO said about 2 months ago on Dynamic Select Forms with Hotwire :
Ah... I think I see the problem. In your code, you're closing the div before the form select for the secondary target. So, the secondary target is NOT part of the stimulus controller.

etmartinkazoo said about 2 months ago on Dynamic Select Forms with Hotwire :
LOL, code is always humbling and in the immortal words of Chris Farley, "Idiot!" I can't believe it was that simple. I truly appreciate your help!

omater PRO said 11 days ago on Dynamic Select Forms with Hotwire :
Hello David!
Is it possible to extend this to a third select option?
If so, how?

Login to Comment