I have this form and I want to prevent it from posting an HTML get request when I select a value.
<%= form_tag study_setup_user_path(@user), id: 'filter-form', method: :get, remote: true do %>
<%= select_tag(:t, options_from_collection_for_select(@user.tags, 'name', 'name', selected: params[:t]), prompt: 'Select Tag', include_blank: true, class: "form-control", onchange: "this.form.submit()") %>
<% end %>
In the controller I have the following study_setup action:
def study_setup
@user = current_user
@vocabs = @user.vocabs.all
@tags = @user.tags.all
if params[:t] != ''
.
.
end
respond_to do |format|
format.js
format.html
end
end
This should already be enough to make the controller handle it as JS, right? But the controller handles it as HTML. Why?