Я работаю на сайте по продаже автомобилей и применил несколько фильтров.
Для UX я добавил символ € и некоторые пробелы автоматически.
Но теперь я хочу, чтобы пользователь нажимал кнопку отправки, удалял пробелы и символ перед выполнением запроса (в данном конкретном случае параметр price_start
будет price_start=2500
вместо price_start=2+500+EUR
)
Я хочу сделать это с помощью Jquery, но я не знаю, как ... Я ценю любую помощь!Спасибо:)
Это мой HTML:
<%= form_tag(filter_vehicles_path, method: 'get') do %>
<h4><strong>
<span>Fabricante</span>
<%= collection_select :manufacturer, :manufacturer_id, Manufacturer.joins(:vehicles).uniq, :id, :name, {include_blank: true}, {class: "manufacturer_dropdown"} %>
<span>Modelo</span>
<%= grouped_collection_select :model, :model_id, Manufacturer.order(:name), :models, :name, :id, :name, {include_blank: true}, {class: "model_dropdown", data: {models: @models}} %>
<span>Preço</span>
<%= select_tag :price_start, options_for_select([ "250 €", "500 €", "1000 €", "2 000 €", "3 000 €", "4 000 €", "5 000 €", "6 000 €", "7 000 €", "8 000 €", "9 000 €", "10 000 €", "12 000 €", "14 000 €", "16 000 €", "18 000 €", "20 000 €", "22 000 €", "24 000 €", "26 000 €", "28 000 €", "30 000 €", "32 000 €", "34 000 €", "36 000 €", "38 000 €", "40 000 €", "50 000 €", "60 000 €", "70 000 €", "80 000 €", "90 000 €", "100 000 €", "150 000 €", "200 000 €"]), include_blank: true, class:"select2PriceFrom" %>
<%= select_tag :price_ending, options_for_select([ "250 €", "500 €", "1000 €", "2 000 €", "3 000 €", "4 000 €", "5 000 €", "6 000 €", "7 000 €", "8 000 €", "9 000 €", "10 000 €", "12 000 €", "14 000 €", "16 000 €", "18 000 €", "20 000 €", "22 000 €", "24 000 €", "26 000 €", "28 000 €", "30 000 €", "32 000 €", "34 000 €", "36 000 €", "38 000 €", "40 000 €", "50 000 €", "60 000 €", "70 000 €", "80 000 €", "90 000 €", "100 000 €", "150 000 €", "200 000 €"]), include_blank: true, class:"select2PriceTo" %>
<span>Ano</span>
<%= select_tag :year_start, options_for_select((1990..Date.today.year).to_a.reverse + ["1980", "1970", "1960", "1950", "1940", "1930", "1920", "1910", "1900"]), include_blank: true, class:"select2From" %>
<%= select_tag :year_start, options_for_select((1990..Date.today.year).to_a.reverse + ["1980", "1970", "1960", "1950", "1940", "1930", "1920", "1910", "1900"]), include_blank: true, class:"select2To" %>
<span>Quilómetros</span>
<%= select_tag :kms_start, options_for_select([ "5 000 km", "10 000 km", "15 000 km", "20 000 km", "25 000 km", "30 000 km", "35 000 km", "50 000 km", "75 000 km", "100 000 km", "125 000 km", "150 000 km", "200 000 km", "250 000 km", "300 000 km", "350 000 km", "400 000 km", "450 000 km", "500 000 km"]), include_blank: true, class:"select2From" %>
<%= select_tag :kms_end, options_for_select([ "5 000 km", "10 000 km", "15 000 km", "20 000 km", "25 000 km", "30 000 km", "35 000 km", "50 000 km", "75 000 km", "100 000 km", "125 000 km", "150 000 km", "200 000 km", "250 000 km", "300 000 km", "350 000 km", "400 000 km", "450 000 km", "500 000 km"]), include_blank: true, class:"select2To" %>
<%= submit_tag "Pesquisar" %>
</strong></h4>
<% end %>