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
0 answers

Rails 4 raty and nested forms button to add questions and update star rate

Hi I have a form and i want to show the nested form to add questions and update the raty stars according to answers the form is given as <%= form_for @interview_round do |f| %>
0
votes
1 answer

Nested form in a table, not working

Can someone help me on how I will put my nested form in a table? my code: #app/view/master_templates/edit.html.erb <%= form_for(@master_template) do |f| %> <%= f.label :name %>
<%= f.text_field :name %> <%=…
0
votes
1 answer

Rails Strong Params & Nested Forms: "Unpermitted parameter: answer"

I have an Assessment model which has many questions and many answers through questions class Assessment < ActiveRecord::Base belongs_to :template belongs_to :patient has_many :questions, :through=> :template has_many :answers, :through=>…
Jackson Cunningham
  • 4,283
  • 3
  • 27
  • 64
0
votes
1 answer

Rails 4 - many to many relation - not updated and does not add new records

I try to adapt my edit action/form and i dont understand but this dont work. My Models are setup as follows (many to many relation): Schema Tables create_table "playlists", force: :cascade do |t| t.string "name", limit: 255 t.string …
0
votes
2 answers

How do I add different field types using rails nested_form

I'm want to use the ryanb/nested_form gem (or similar) to create associations with many different field types. Consider a model called content which might have many content_blocks that should have text inputs, text areas, or image upload fields…
0
votes
1 answer

When updating a nested form, how do I do something with new records?

class Photo < ActiveRecord::Base has_many :item_photos has_many :items, through: :item_photos end class Item < ActiveRecord::Base has_many :item_photos has_many :photos, through: :item_photos accepts_nested_attributes_for :photos end…
Brian Graham
  • 142
  • 1
  • 7
0
votes
0 answers

Unpermitted parameters: nested form attributes(paperclip) Rails 4

I've searched all similar posts but can't figure out whats wrong with my code. Error: Unpermitted parameter: photos. I have a users model which has many projects and then the projects has many photos. Here is the code: Models: class Project <…
0
votes
0 answers

accepts_nested_attributes_for with multiple nesting and polymorphic association

I'm trying to pass two-levels nested attributes hash while updating model: class Item < ActiveRecord::Base has_many :steps accepts_nested_attributes_for :steps end class Step < ActiveRecord::Base belongs_to :item has_many :messages, as:…
0
votes
1 answer

Nested form in Rails not saving

I'm using Rails 4.2 with cocoon gem for building nesting form. Everything is saving and displaying just fine except when I want to make new person through entities form. Goal is to make new person on the fly at the same form where i will make new…
0
votes
0 answers

Unable to save Join Table details to database in Rails 4

I've always had trouble with has_many :through relationships on join tables and am stuck again on where I'm going wrong. I think it might be in my controller as I'm still getting to grips with how it all works. I have three models: class Role <…
0
votes
1 answer

Editing an entry with two unique columns

The problem: When I'm editing the contents of a nested model, it saves new entries instead of editing the ones already there. The models: # job.rb class Job < ActiveRecord::Base # Relations has_many :logs, :dependent => :destroy …
Wes Foster
  • 8,202
  • 4
  • 36
  • 57
0
votes
2 answers

Don't build another association if one already exists

I have some problems getting a nested form working. In the below example I have a User that can define multiple custom labels for a post. The user should be able to enter a value for each particular label. So one Post can have multiple labels, but…
0
votes
1 answer

Create two interdependent models from one form in rails

I have used a combination of answers from 21222015, 17572279, 2663141, and RailsGuide to try and get multiple interdependent models to be created from a form. In my application Users are used for authentication and Clinicians and Patients are models…
Skiapex
  • 133
  • 1
  • 14
0
votes
2 answers

How to declare objects for nested form in rails 4

I'm approaching my 2nd week of using rails, and have almost gotten the structure of my app complete (I think/hope). I'm building a staff website for a charity, which as part of their work collects and wipes computers (before sending them to African…
North Laine
  • 334
  • 1
  • 13
0
votes
0 answers

Ruby on Rails Nested Forms - Unpermitted Parameters: users_attributes

When trying to add users to a band using the nested_form gem, I am unable to access the users from the params. After some investigation I noticed that I was getting an unpermitted parameters error in the console. I need to access users_attributes so…