simple-form

Ruby on Rails - Simple Form autocomplete association search

核能气质少年 提交于 2021-01-27 07:33:02
问题 I've a form in a basic task management app which allows Tasks to be assigned to Users (task belongs_to user). I'm using Simple Form for this. Currently, the association is populated in the typical manner, with a dropdown list of users as such: <%= f.association :user, label_method: :name, value_method: :id, include_blank: false %> . However, as the number of Users grows, I'm looking to change this to an autocomplete form field to find users. I've tried following the Railscast on the subject,

ActionView::Template::Error: wrong number of arguments (Simple Form)

喜你入骨 提交于 2020-07-22 21:44:31
问题 I have a Rails 4 app that always worked, but now a page with a simple_form_for is generating an error. I dropped all the code, leaving just the simple_form_for and still yet I'm getting error. The page with errors (_form.html.erb): <%= simple_form_for @anuncio do |f| %> <%= f.input :titulo %> <% end %> When I execute this page, I get this error: F, [2015-01-08T16:16:21.920151 #19971] FATAL -- : ActionView::Template::Error (wrong number of arguments (3 for 2)): 1: <%= simple_form_for @anuncio

ActionView::Template::Error: wrong number of arguments (Simple Form)

岁酱吖の 提交于 2020-07-22 21:41:41
问题 I have a Rails 4 app that always worked, but now a page with a simple_form_for is generating an error. I dropped all the code, leaving just the simple_form_for and still yet I'm getting error. The page with errors (_form.html.erb): <%= simple_form_for @anuncio do |f| %> <%= f.input :titulo %> <% end %> When I execute this page, I get this error: F, [2015-01-08T16:16:21.920151 #19971] FATAL -- : ActionView::Template::Error (wrong number of arguments (3 for 2)): 1: <%= simple_form_for @anuncio

Pre Select an option in the select box in a modal depending on other selected value from another page

我是研究僧i 提交于 2020-07-06 04:47:24
问题 I have an accordion here is the code: <div class="accordion"> <div class="accordion-title accordion-area"> <a href="#joinus/jr-software-engineer/" id="accordion-link">Junior Software Engineer</a> </div> <div class="accordion-container">This is the Body <a href="#apply" class="btn btn-hire"> Apply Now</a></div> <div class="accordion-title accordion-area"> <a href="#joinus/sr-software-engineer/" id="accordion-link">Senior Software Engineer</a> </div> <div class="accordion-container">This is the

Pre Select an option in the select box in a modal depending on other selected value from another page

。_饼干妹妹 提交于 2020-07-06 04:44:59
问题 I have an accordion here is the code: <div class="accordion"> <div class="accordion-title accordion-area"> <a href="#joinus/jr-software-engineer/" id="accordion-link">Junior Software Engineer</a> </div> <div class="accordion-container">This is the Body <a href="#apply" class="btn btn-hire"> Apply Now</a></div> <div class="accordion-title accordion-area"> <a href="#joinus/sr-software-engineer/" id="accordion-link">Senior Software Engineer</a> </div> <div class="accordion-container">This is the

change size and maxlength allowed for a field in simple_form

こ雲淡風輕ζ 提交于 2020-06-08 04:43:43
问题 How can I change the size and max allowed characters for a field using Simple Forms. I've tried following but does not work: <%= f.input :lastname, :size => 40, :max => 4 %> I know there is a default_input_size in initializers/simple_form.rb however, I don't want to change the size globally but just on few fields. How would I do this? 回答1: <%= f.input :lastname, input_html: { maxlength: 15, size: 40} %> 回答2: try to use <%= f.input :lastname, :input_html => {:size => 40, :maxlength => 4} %>

change size and maxlength allowed for a field in simple_form

拈花ヽ惹草 提交于 2020-06-08 04:43:26
问题 How can I change the size and max allowed characters for a field using Simple Forms. I've tried following but does not work: <%= f.input :lastname, :size => 40, :max => 4 %> I know there is a default_input_size in initializers/simple_form.rb however, I don't want to change the size globally but just on few fields. How would I do this? 回答1: <%= f.input :lastname, input_html: { maxlength: 15, size: 40} %> 回答2: try to use <%= f.input :lastname, :input_html => {:size => 40, :maxlength => 4} %>

Easiest way to design a form, where displayed form options are dependent on input

一曲冷凌霜 提交于 2020-04-18 07:12:49
问题 I tried setting up a waaaaaaay too complex order form (How to set up a order form with options belonging to a product_category) Therefore, I am trying to take it slow and split up my order form, where: first an product_category is selected and if the product_category is available, the user can select the product and options belonging to the product_category . Is there a way to do this with a multi-step form http://railscasts.com/episodes/217-multistep-forms? Or are there easier methods to

Easiest way to design a form, where displayed form options are dependent on input

▼魔方 西西 提交于 2020-04-18 07:12:06
问题 I tried setting up a waaaaaaay too complex order form (How to set up a order form with options belonging to a product_category) Therefore, I am trying to take it slow and split up my order form, where: first an product_category is selected and if the product_category is available, the user can select the product and options belonging to the product_category . Is there a way to do this with a multi-step form http://railscasts.com/episodes/217-multistep-forms? Or are there easier methods to

Nest Input Inside Label with Simple_Form and Rails 4

雨燕双飞 提交于 2020-01-17 06:23:09
问题 I'm using Rails 4 and Simple_Form for an application, and for the front end layout I have to implement, I need to be able to have the input tag inside a label tag. The output needs to look like this: <label class="input string optional profile_first_name"> <input class="string optional" type="text" value="" name="profile[first_name]" id="profile_first_name"> </label> I tried creating a custom wrapper that looked like this: config.wrappers :custom_form, tag: 'div', class: 'form-group', error