'How to use collection select as a button in Rails?

In my form I have a collection_select to be able to select the name of the articles, my problem is that when I select any article nothing happens

 <%= form_with url: articles_path do |f| %>
   <%= collection_select(:article, :article_id, @articles, :id, :name ) %>
 <% end %>

Of course I would be missing the submit button, but I would like the user to simply select the article name and pass the data to the controller (without having to put a button below collection_select)

I can't find the way, if someone knows about it and can guide me I would be very grateful

Thank you for your time in reading me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source