Questions tagged [simple-form]

Questions about "Simple Form" which generates view code for forms in Rails. This tag is NOT related to "SimpleForm" in OpenUI5.

simple-form
Filter by
Sorted by
Tagged with
8 votes
2 answers
7k views

Adding * to required form labels

Does anybody have a nice way of adding * to required form labels, without having to turn to tools like SimpleForm? I did not like the way SimpleForm added all these weird wrappers and classes to my ...
Mark Boulder's user avatar
1 vote
2 answers
703 views

Is it possible to use a scope as source for association with simple_form?

Is it possible to use a scope as source for association? class User < AR scope :active_users, where('status = 4') ... # form <%= f.association :active_users %> ...
tonymarschall's user avatar
12 votes
4 answers
11k views

Serialized Hash field and Simple Form

I have the following. class Page < ActiveRecord::Base belongs_to :category serialize :fields end The value of fields will depend on the category. But as an example; {"address" => "8 ...
Matthew Rudy's user avatar
  • 16.8k
0 votes
1 answer
2k views

Simple_form & Twitter Bootstrap: Form labels unaligned, missing HTML in production?

When I go into production, my forms change causing the labels and fields to be unaligned from each other. In development it works correctly but not in production. Here is what I mean: Development &...
LearningRoR's user avatar
4 votes
2 answers
7k views

How do I pass in a parameter to a hidden_field_tag in my form in Rails 3?

I'm trying to get a messaging feature working (using the acts-as-messageable gem) and I want a user to send a message without having to enter a ':to' field. In my /users/show.html.erb I have: <%=...
ralphos's user avatar
  • 626
0 votes
1 answer
693 views

Rails 3.1, why simple_form's wrapper_tag does not work as expected?

When I use wrapper_tag in simple_form, it works fine in development mode, but, when I deploy the application to heroku, the rendered result is different. I use the wrapper_tag like this: <%- ...
simo's user avatar
  • 24k
0 votes
2 answers
487 views

Rails 3.2.1 nested attributes generating wrong output

HTML output generated code is wrong. I have the following Post model class Post < ActiveRecord::Base belongs_to :user attr_accessible :title, :description, :price, :status, :pageviews, :...
Kleber S.'s user avatar
  • 8,150
0 votes
1 answer
333 views

MongoMapper default values and simple_form

I have a Character model which has some defaults and have created a simple form for it (or rather a subclass of the Character model) all tied together by a controller. The problem is that the form ...
Kostas's user avatar
  • 8,475
2 votes
5 answers
9k views

Multiple inputs on a single line with Twitter Bootstrap and Simple Form 2.0

I am using simple_form 2.0 with twitter bootstrap. I am trying to determine what is the proper wrapper format in order to get something like [city] [State] [Zip] I believe my form needs to be <...
noel_g's user avatar
  • 394
2 votes
1 answer
2k views

Complex Form Nesting in Rails - How to create the desired hash / array params output

I'm trying to figure out how to properly handle the params hash so as I dont pass params that should be nested multiple times.. Here is a simplified(removed not-needed info like labels etc) of my ...
ranx's user avatar
  • 23
4 votes
2 answers
2k views

Integration Simple-form 2.0.0 and Zurb

In the new simple_form gem ( 2.0.0 ), there are a wrapper to twitter. But I prefer using zurb-foundation. So I try create this wrapper. Anyone has some input to create the wrapper ?
shingara's user avatar
  • 46.8k
0 votes
1 answer
242 views

how to use composed_of in Rails 3

I'm development an application using Rails 3.1.1 + devise 1.5.0 + simple_form 1.5.2. I need that an user has an address and then I created one class address. The address class is used as a composed_of ...
Diego Dias's user avatar
18 votes
5 answers
42k views

how to add a class to the input component in a wrapper in simple_form 2

I am trying to have class="text" in my input fields when using a custom wrapper called :hinted in simple_form 2.0.0.rc config.wrappers :hinted do |b| b.use :input, :class => "text" end but the ...
Nik So's user avatar
  • 16.8k
40 votes
4 answers
19k views

Does form_tag work with Simple_form?

I have a form that is using form_tag and not sure how to use it with the simple_form gem. This is how my form looks: <%= form_tag create_multiple_prices_path, :method => :post do %> <% ...
LearningRoR's user avatar
11 votes
8 answers
14k views

Twitter-Bootstrap: Simple_form not making horizontal form or correct HTML output?

I don't know why Its not duplicating like the example. When I put the following code to have this form: <%= simple_form_for(resource, :as => resource_name, :url => registration_path(...
LearningRoR's user avatar
1 vote
2 answers
5k views

simple_form multiple inputs inline

I'm using simple_form 1.5.2 + rails 3.1 gem in my project, but simple_form generates one input per line. How to do to have more of one inputs per line?
Diego Dias's user avatar
5 votes
3 answers
5k views

When using simple_form in Rails, how can I use it just to show data for some of the fields rather than have inputs?

I'm creating my forms using simple_form and it's all good, apart from when I want to just display some text rather than show an input box of some type. So I need to show a label and also the display ...
cmrichards's user avatar
  • 1,725
0 votes
1 answer
563 views

Rails simple_form number_field lost functionality?

I am new to simple_form and I was wondering if its possible to have a f.number_field functional like in normal rails. What I am interested in is the side 'increase'/'reduce' buttons and the posibility ...
ranx's user avatar
  • 23
3 votes
1 answer
1k views

how to add extra components to the new simple_form 2.0.0.rc

I am trying to add an extra component called Description, which is just a div with some text, before the INPUT component in a wrapper called :with_descripiton I have in my initializer: config....
Nik So's user avatar
  • 16.8k
32 votes
6 answers
51k views

add checkbox with simple_form without association with model?

How I can add checkbox with simple_form without association with model? I want to create checkbox which will handle some javascript events, but don't know? Maybe I miss something in documentation? ...
Mikhail Grishko's user avatar
0 votes
1 answer
896 views

Simple_form style the collection_label's

I have this simple_form <%= simple_form_for(@order) do |f| %> <%= f.error_notification %> <%= f.association :orderstatus, :label => false, :...
bcackerman's user avatar
  • 1,506
0 votes
1 answer
1k views

undefined method `simple_nested_form_for'

I'm getting this error when trying to use the nested_form Rails plugin, what's wrong? I've set my Gem file to say gem "nested_form", :git => 'git://github.com/ryanb/nested_form.git' I've ...
bcackerman's user avatar
  • 1,506
16 votes
5 answers
31k views

How to set a field read only in rails 3.1.0 views?

My question is how to set a field in rails form read only. The following is a selection box in quotes controller. Users are not allowed to change the selection. <% @quote.test_items.each do |t| %...
user938363's user avatar
  • 10.1k
0 votes
1 answer
403 views

Simple_form doesn't load collection after render error_message

In my create user view <%= simple_form_for @user do |f| %> <%= render 'shared/error_messages', :object => f.object %> <%= f.input :size, :collection => @plan, :label_method =>...
RedRory's user avatar
  • 632
58 votes
2 answers
60k views

rails, simple_form, how to set selected index of a collection when page loaded?

I am using simple_form gem, I have a countries collection, it work fine when I select the country, and updated record will have the country id stored, but, when I try to edit the record, the chosen ...
simo's user avatar
  • 24k
0 votes
1 answer
92 views

How to only display the name of an associated record in rails 3.1.0

There are rfq, quote and test_item in our rails 3.1.0 app. RFQ has many quotes and test items. Quote belongs to a rfq and has many test items. Test item has many rfqs and quotes. When creating a ...
user938363's user avatar
  • 10.1k
3 votes
0 answers
683 views

Rails simple_forms collections radio button broken down

I am attempting to make a voting system for some video. On the vote page I want a radio button for each finalist and next to it an image pulled form youtube the file name and the finalist name. I have ...
SuddenlyAwakened's user avatar
35 votes
2 answers
27k views

Change id in simple form

How change default id or class, which produce simple form: = simple_form_for(@account, url: account_url, validate: true, wrapper: :inline, html: { method: :put }) do |f| html: <form accept-...
Mikhail Grishko's user avatar
10 votes
3 answers
8k views

How do I change the html tag and class generated by fields_for?

This is a simple question that I'm kinda ashamed to ask, but I've been banging my head against the wall and navigating through the rails 3 documentation without any success :/ So, here is the thing: ...
Hector Villarreal's user avatar
3 votes
4 answers
10k views

How to populate a rails simple_form select box using an index?

hopefully this isn't too complicated.. So I have a model with LOTS of attributes, which I've decided to store as indexes in the database which refer to an constant at the model: class Profile < ...
MBHNYC's user avatar
  • 1,268
2 votes
1 answer
2k views

Rails - Simple Form - Not loading class option

I'm having some troubles when I want to change the class of a form. I have this partial: <%= simple_form_for(@activity) do |f| %> <%= f.input :name %> <%= f.submit 'Guardar',:...
JavierQQ23's user avatar
0 votes
1 answer
438 views

How to add selection box dynamically in rails 3.1.0?

Here is a partial form _standards.html.erb we want to add to the view dynamically: <p><%= f.association :standards, :collection => Standard.active_std.all(:order => 'name'), :...
user938363's user avatar
  • 10.1k
1 vote
1 answer
295 views

link_to_function does not react to click in rails 3.1.0 & simple_form

Here is the code in rfqs/_form_new.html.erb to add a selection box for standard. <%= simple_form_for @rfq do |f| %> <div id="std"> <%= render :partial => 'standards/...
user938363's user avatar
  • 10.1k
1 vote
3 answers
3k views

How to have a collasped drop down list in rails simple_form

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: <%= ...
user938363's user avatar
  • 10.1k
1 vote
1 answer
252 views

using formtastic with forem instead of simple_form

I am building my rails app and using forem to integrate forum in it. I have been using formtastic till now and forem uses simple_form. I want to replace simple_form with formtastic in forem however ...
Dev R's user avatar
  • 1,902
0 votes
2 answers
2k views

How to customize simple_form to output error text in span title

By default, simple_form generates error messages in this form: <span class="error">"error_text"</span> but what i need is something like: <span class="error" title="error_text">&...
Nox's user avatar
  • 395
1 vote
1 answer
529 views

Generate form from a Hash in Rails 3

I need to generate a form from a hash and get it back its posted params in a hash. for this, i created this class. class Hashit include ActiveModel::Conversion extend ActiveModel::Naming def ...
Nazar Hussain's user avatar
0 votes
1 answer
1k views

How to pass an array in a variable for :collection in form for rails?

Here is a simple_form code in _form.html.erb. <%= f.input :start_time, :label => "Start Time:", :collection => @time_slot %> @time_slot is a variable defined in the controller. It is ...
user938363's user avatar
  • 10.1k
2 votes
2 answers
4k views

Changing simple_form date input to have three string inputs instead of three drop down menus

I'm using simple_form gem on a form, and want to use date fields with three text_fields fields instead of three select fields. I tried this: <%= profile_form.simple_fields_for :birthday do |date| ...
Victor Martins's user avatar
0 votes
1 answer
465 views

simple_form, bug with :has_many :through relation?

I have 3 models like these: class CertificatorBtwInstructor < ActiveRecord::Base belongs_to :certificator belongs_to :instructor # other code ... end class Certificator < ...
easteregg's user avatar
  • 149
8 votes
3 answers
7k views

How do I use collection_check_boxes with an Array?

So I'm using simple_form for building my forms, this is not a requirement though. What I am trying to do is using simple_forms collection_check_boxes and pass it an array. I am storing my tags in ...
Tim Brunsmo's user avatar
1 vote
1 answer
639 views

Rails form tag errors out when encountering a binary field

I have a binary column type in my "users" table and when I try to include that field within simple_form_for tag, I get an error. = simple_form_for @user = f.input :secret_number Here's the error- ...
kapso's user avatar
  • 11.8k
1 vote
1 answer
795 views

helper view with haml and simple_form

I tried to insert a simple_form helper into a view helper (sorry for the pun) and using it with the Haml::Helpers, example: def front_box_search_html(form_object) my_custom_wrapper() do ...
easteregg's user avatar
  • 149
3 votes
1 answer
5k views

Rails simple_form association select with create option

I have a form with a belongs_to assocation, and I'd like the user to be able to either select from their addresses, or create a new one. It breaks when the form has validation errors because of ...
tom's user avatar
  • 718
5 votes
1 answer
3k views

Rails 3.1 not rendering the fields_for from nested_form

I have a project model that has_many :tasks. I added a nested resource in rails 3.1 and try now with the nested_form gem to be able to add/delete tasks when editing a project. I used nested_form ...
tmaximini's user avatar
  • 8,443
8 votes
3 answers
7k views

Rails forms for has_many through association with additional attributes?

How can I generate form fields for a has_many :through association that has additional attributes? The has_many :through relationship has an additional column called weight. Here's the migration ...
Marco's user avatar
  • 4,365
41 votes
2 answers
25k views

simple_forms custom data attribute

I would like to have an additional data attribute on an input tag generated by simple_form. The following does not work: <%= f.input :date, :as => 'date_picker', :data => {:datepicker => :...
Ynv's user avatar
  • 1,894
2 votes
2 answers
2k views

Customizing simple_form gem association display

I'm using the simple_form gem in Rails 3.1 app and I want do customize the way the associations are displayed. Today, for this code: <%= f.association :grupos, :include_blank => false, :...
razenha's user avatar
  • 7,720
0 votes
1 answer
739 views

Rails 3.1 simple_form renaming fields w/o i18n

I've been starting to use simple_form in my rails application, which is quite nice. But I was not able to find a function which allows me to rename a field, without the use of i18n. I have a radio ...
Christian's user avatar
  • 227
3 votes
1 answer
1k views

Rspec test on Simple Form Associations

I am trying to run a request spec on a form (built with Simple Form). The form includes some select boxes that are generated using the association method and therefore database values for the model. ...
Edward Ford's user avatar
  • 1,631