simple-form

Multiple select in collection

落花浮王杯 提交于 2020-01-05 04:38:13
问题 I would know how i can allow multiple selection on my field I have a simple_form field like this <%= f.input :activity, required: true, autofocus: true, label: "Votre Activité", collection: ["Vente", "Location", "Gestion", "Syndic"] %> In my controller devise_parameter_sanitizer.permit(:account_update, keys: [:password, :password_confirmation, :photo, :address, :cover, :activity) My model validates :activity, inclusion: { in: %w(Vente Location Syndic Gestion), message: "%{value} n'est pas un

Empty array value being input with simple_form entries

非 Y 不嫁゛ 提交于 2020-01-05 04:20:18
问题 I'm still new to rails and simple_form and have been trying to implement a multiple select option to give a user multiple roles. Current input looks like this <%= f.input :secondary_role, :collection => UseridRole::VALUES, :include_blank => false,:label => "Secondary Role(s):", :input_html => { :class => " simple_form_bgcolour simple_form_position overide_selection_field_width", :size => 4, multiple: true } %> So, this does work, but is including an empty value at the start of my array:

How to add dynamic checkboxes based on form input?

耗尽温柔 提交于 2020-01-05 04:18:14
问题 Context A user can fill in an order form where a bike_type can be chosen and consequently the options belonging to that bike_type. Current situation Based on user input ('bike_type') in a simple_form column, I would like to include a checkbox with all potential options ('options) where multiple options can be selected. Currently, I am able to: (Situation 1) Display all the options for the respective bike_type via Ajax in the view, but unfortunately these are not being sent in the params.

simple_form 'form-inline' not working

放肆的年华 提交于 2020-01-04 06:05:20
问题 I'm trying to make two input (firstname and lastname) to next to each other. Here is my code and it's currently just showing two big rows of input window. = simple_form_for @user, html: {class: 'form-inline'} do |f| = f.fields_for :profile, @user.profile || Profile.new, html: {class: 'form-inline'} do |p| .form-1 .form-1-detail .input-text = f.input :last_name, required: true .input-text = f.input :first_name, required: true I'm now sure how to make them to display inline. Can anyone help me?

simple_form 'form-inline' not working

别说谁变了你拦得住时间么 提交于 2020-01-04 06:03:20
问题 I'm trying to make two input (firstname and lastname) to next to each other. Here is my code and it's currently just showing two big rows of input window. = simple_form_for @user, html: {class: 'form-inline'} do |f| = f.fields_for :profile, @user.profile || Profile.new, html: {class: 'form-inline'} do |p| .form-1 .form-1-detail .input-text = f.input :last_name, required: true .input-text = f.input :first_name, required: true I'm now sure how to make them to display inline. Can anyone help me?

How SimpleForm maxlength extension works

≯℡__Kan透↙ 提交于 2020-01-03 18:11:12
问题 I want to set the maxlength html attribute of the inputs on my forms created with the help of the SimpleForm gem. I know I can do this by passing in the maxlength attribute manually when creating the form, e.g.: <%= f.input :username, input_html: { maxlength: 20 } %> But that isn’t want I want because according the comments in the SimpleForm config file you should enable the maxlength extension which adds automatically this html attribute to the input tag for string attributes when a max

Nested table formatting with simple_form, nested_form and twitter-bootstrap

旧巷老猫 提交于 2020-01-03 09:12:11
问题 Update: I updated this after doing some digging and realizing that this might be twitter-bootstrap causing the problem. Here is a rough version of my nested form: <%= simple_nested_form_for @user, :html => { :class => 'form-horizontal' } do |f| %> <fieldset> <%= f.input :email %> <%= f.input :name_first %> <%= f.input :name_last %> <table class="table table-striped"> <thead> <tr> <th>Active</th> <th>Company</th> <th>Role</th> <th>Actions</th> </tr> </thead> <tbody> <%= f.simple_fields_for

Rails 4 - JS for dependent fields with simple form

谁说我不能喝 提交于 2020-01-03 07:17:34
问题 I am trying to make an app in Rails 4. I am using simple form for forms and have just tried to use gem 'dependent-fields-rails' to hide or show subset questions based on the form field of a primary question. I'm getting stuck. I have added gems to my gem file for: gem 'dependent-fields-rails' gem 'underscore-rails' I have updated my application.js to: //= require dependent-fields //= require underscore I have a form which has: <%= f.simple_fields_for :project_date do |pdf| %> <%= pdf.error

How to have a collasped drop down list in rails simple_form

假装没事ソ 提交于 2020-01-03 03:54:10
问题 In my app, there are two models: rfq and standard. Their relationship is many-to-many. In rfq creating screen, the code below displays a list of available for selection in drop down list: <%= simple_form_for @rfq do |f| %> <%= f.association :standards, :collection => Standard.active_std.all(:order => 'name'), :label_method => :name, :value_method => :id %> <% end %> The problem is that the list is not collapsed, which means there are multiple standards displayed in a multi-line boxes. How can

Sorcery and Simple Form implementation

百般思念 提交于 2020-01-03 02:33:09
问题 long time reader first time user. I'm putting together my first RoR application and I've isolated everything my app should use down to:- Sorcery Omniauth CanCan twitter-bootstrap (converted to sass) and Simple Forms. Clean, clear and simple....Not. Cannot for the life of me integrate (what would seem to be the most simplest of tasks) simple forms with a Sorcery "Login" without getting errors on the 'remember_me' field. Simple forms doesn't have a simple_form_tag (only simple_form_for) option