mercredi 11 novembre 2020

Is it possible to use onchange on base select option

Is there a way to use a submit onchange on this select option. I know I can do it on the <% f.select%> one with :onchange => 'this.form.submit()'), but I can't find any documentation on how to do it on this select statement.

<%= form_for(@profile_option, remote: true) do |form| %>

    <div class="form-group" id="profile_options_budgetid" >
      <div class="h7 text">Select Budget to Show</div>
         <select class="custom-select" name="profile_options[budget_id]" id="profile_options_budgetid">
           <option disabled value="" selected hidden>Please Select</option>
           <% Budget.where(user_id:current_user).each do |budget| %>
           <option value=<%= budget.id %>> Budget: <%= budget.month %> <%= budget.year %>
            </option>
                                            
             <% end %>
         </select>
      </div>
<% end %>

Aucun commentaire:

Enregistrer un commentaire