min_max and range sliders

20 views
Skip to first unread message

Aja Hammerly

unread,
Feb 28, 2017, 11:10:10 PM2/28/17
to SimpleForm
I can't seem to get simple_form to use my validators to set the min and max appropriately on range sliders. Here's the model:

class Vote < ApplicationRecord
  validates :score, numericality: { only_integer: true, greater_than: 0, less_than: 11 }
end


Here's what I have in the form:

<%= simple_form_for(@vote) do |f| %>
  <%= f.error_notification %>

  <div class="form-inputs">
    <%= f.input :score, as: :range %>
  </div>

  <div class="form-actions">
    <%= f.button :submit %>
  </div>
<% end %>


I've tried specifying the inner_html, html, min_max: true and I can't make the min and max show up on the range slider. I've tried turning on the browser_validations and changed the min_max optional to use in simple_form.rb. Nothing seems to work. Any idea what could fix this? 

Reply all
Reply to author
Forward
0 new messages