Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8752541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:15:23+00:00 2026-06-13T13:15:23+00:00

I have one form in view for the @item_list : <%= form_for @item_list do

  • 0

I have one form in view for the @item_list:

<%= form_for @item_list do |f|%>
   some meta-info to describe item_list
<%end%>

and also I have a render partial called _item.html.erb:

<%= form_for @item_list.item do |f|%>
   some meta-info to describe item_list.item
<%end%>

In my index view, I have a button called add item, which will call a jquery ajax function to append this partial to a div block, and another button called done, which I expect to store all the info in all the forms at one time.

When I try to save these, the parameter doesn’t include the item information. I guess that is because I didn’t update the item_list at the backend when I tried to add a new item. I hope you can provide me some ideas on this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:15:24+00:00Added an answer on June 13, 2026 at 1:15 pm

    You’re going to want to setup a nested form for this. There are many other questions on stackoverflow about nested forms, but here’s the gist:

    • Create a new empty object in your controller to populate an item @item_list.items.build assuming an ItemList has_many Items
    • Add accepts_nested_attributes_for :item in your Item model
    • Add attr_accessible :items_attributes in your Item model as well
    • You’re going to need to pass your form builder to the partial, so something like this:

      _form.html.erb
      
      <%= form_for @item_list do |f| %>
        <% @item_list.items.each do |item| %>
           <%= render 'item', :f => f %>
        <% end %>
      <% end %>
      
      _item.html.erb
      
      <%= f.fields_for :items, item do |item_form| %>
          <%= item_form.text_field ... %>
      <% end %>
      

    If you need more specifics, please provide us with some more code, including your models with relationships. I’ll leave the javascript to you at this point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have below html code in one of the opensource project. <form action=/wiki/bin/view/Main/Search> <div
i have one form which have some input box and some select box. i
I have one form with several text fields and one button. When i enter
I have one form in a PHP (5.2.9-1) application that causes IIS (Microsoft-IIS/6.0) to
so here's the problem I have one form, it outputs search results after submit,
I need to make the program which have one form that contains PNG image
I am creating one form in html using table. Which have one Drop down
I have one windows form file that each time I open it in Visual
I have WPF Application where I have One main form and other user controls
in my project i have one registration form which is developed in C#.net.to this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.