Questions tagged [nested-forms]

A form within another form, often in the ruby-on-rails environment.

This is a Rails gem for conveniently manage multiple nested models in a single form. It does so in an unobtrusive way through jQuery or Prototype.

This gem only works with Rails 3.

Nested forms are when a form is placed within another form, often in the environment.

As of HTML 5, the form element can't be nested. Check section 4.10.18, "Association of controls and forms" for more information.

The platform can also handle nested forms, like the example below:

<div class="form">
    <?php $this->renderPartial('_form', array('form'=>$form)); ?>
    <?php echo $form['user']; ?>
    <?php echo $form['profile']; ?>
    <?php echo $form['subformbuttons']; ?>
</div>

Check the section for general questions and details about forms.

1948 questions
0
votes
1 answer

What could be causing nested_form not to output the correct chosen input value?

So I'm using nested_form (v0.3.2 according to Gemfile.lock) with Rails 3.2.11. I have a Service model with a category field that initially can take on multiple values that can be input via a select dropdown. The categories are something like: ["J…
Nona
  • 4,534
  • 6
  • 27
  • 57
0
votes
3 answers

Traversing over nested parameters in rails 4

Is there a way to traverse over parameters in rails? I have a nested params: "request"=>{"name"=>"Gianni Hayes", "address"=>"5858 Bernhard Burgs", "phone"=>"(972) 399-9601", "mobile"=>"777 777 01 02", …
yerassyl
  • 2,622
  • 3
  • 29
  • 56
0
votes
1 answer

jQuery line function is not defined

I have a TypeError: $(...).data(...) in this line $(this).before($(this).data('daw_preguntaes').replace(regexp, time));}. I am using Railscast 196, but this function don't load the new fields i want to show. I don't know what to put in the…
vimx
  • 129
  • 2
  • 9
0
votes
1 answer

How to add and edit multiple models with nested forms and has_many :through

I believe I've read all related answers on SO but still not found a solution, so here's my issue. I have 'inherited' an application that is to work with Products, Batches and Quantities. A Batch will have many Products, Products can appear in many…
mvanio
  • 505
  • 3
  • 14
0
votes
1 answer

ActionController::UnpermittedParameters in StaplesController#create when I aply nested_attributes with polymorphic association

I'm desperate... I had tried all advices from all possible relevant sources I found, but nothing helps. I'm using ruby 2.0.0 rails 4.1.8 and nested_form gem. It still produces the same error: ActionController::UnpermittedParameters in…
0
votes
3 answers

Nested form problem in Rails : NoMethodError in Show

I'm trying to build a simple product backlog application to teach myself Rails. For each product, there can be multiple product backlog entries, so I want to create a product view that shows the product information, all the backlog entries for the…
Brian
  • 113
  • 1
  • 1
  • 8
0
votes
1 answer

many-to-many with has_many :through association nested form

student.rb class Student < ActiveRecord::Base has_many :enrollments has_many :courses, through: :enrollments accepts_nested_attributes_for :enrollments end enrollment.rb class Enrollment < ActiveRecord::Base belongs_to :student …
0
votes
1 answer

Nested Models in rails

I have two models, Student and School #in student.rb has_one :school, dependent: :destroy accepts_nested_attributes_for :school #in school.rb belongs_to :student validates_presence_of :name Now I have a script that uploads the names of the…
Tiamon
  • 217
  • 2
  • 12
0
votes
0 answers

Hiding Nested Form Fields and Divs

I'm using the nested_form gem in my ruby on rails 4 application. In each nested form that is added, there are several divs with fields in them. I want to hide the content of those divs when the nested form is added. With my current jQuery function,…
Questifer
  • 1,033
  • 2
  • 17
  • 42
0
votes
2 answers

Why won't rails create associated records/objects from nested form using strong parameters?

I'm trying to create a record and it's associated records from a nested form using strong parameters. My primary model is: class MaterialDonationRequest < ActiveRecord::Base has_many :donation_items, dependent: :destroy …
tobogranyte
  • 839
  • 7
  • 23
0
votes
1 answer

Form helpers for nested attributes has_many through in rails 4

I have 3 models with has_many through association: class Spot < ActiveRecord::Base has_many :seasons has_many :sports, through: :seasons accepts_nested_attributes_for :sports, :seasons end class Sport < ActiveRecord::Base has_many…
0
votes
1 answer

Building Rails Nested Form Within Nested Form

I have a rails form that includes a parent, child, and a child of the child. I'm using the nested_form gem and my rails version is 4.1. The issue I'm encountering is with a nested form with a nested field within it. I don't want to have the user add…
Questifer
  • 1,033
  • 2
  • 17
  • 42
0
votes
2 answers

Rails 4, add dynamic fields without nested attributes

I'm currently sitting with a problem where I am trying to add dynamic fields, and it works, however I need to created a second model for the nested attributes that are dynamically generated on the field. I have a very easy and simple form which asks…
Codelove
  • 68
  • 1
  • 8
0
votes
1 answer

RoR: How to set the value in a collection_select from the database in the edit view (1:many relation)

I am at the moment creating a complicated rails form for 1:n relationship with nested form and collection select with values from yet another data table. So far, it overwrites the database value with the first entry in the values list of the…
0
votes
1 answer

How to get id and show value in a table on index

I can only view the child values in the "show" template using: <% @guest.plusones.each do |plus| %> <%= plus.name %> <%= plus.oldness %> <% end %> I now need display these values in a table on the "index" template. How can I do this? See…
1 2 3
99
100