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

  • Home
  • SEARCH
  • 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 8078057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:40:11+00:00 2026-06-05T15:40:11+00:00

I’m having problems adding a new table row by clicking the link_to_add function link.

  • 0

I’m having problems adding a new table row by clicking the link_to_add function link.

  • 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-05T15:40:12+00:00Added an answer on June 5, 2026 at 3:40 pm

    As it took me some search and try&error to find out here is my solution. The key to it was using the cocoon gem by nathanvda (instead of nested_form by ryanb) that allows to define a jquery selector (called data-association-insertion-node) on where to insert the new fieldset. In my example I’m using HAML and Twitter Bootstrap code, but you can easily replace it with your own favorites.

    /app/views/users/_form.html.haml:

    = simple_form_for @user, :html => {:class => "form-horizontal"} do |f|
      = render "shared/error_messages", :target => @user
      .row-fluid
        .span12
          .fieldset
            = f.input :username, :label => "Username:", :placeholder => "Username"
    
            %table.table
              %thead
                %tr
                  %th
                    %i.icon-calendar
                    Date
                  %th
                    %i.icon-pencil
                    Description
                  %th
                    %i.icon-cog
                    Action
              %tbody#user_events
                = f.simple_fields_for :user_events do |event|
                  = render "user_event_fields", :f => event
    
            = link_to_add_association f, :user_events, :"data-association-insertion-node" => "tbody#user_events", :"data-association-insertion-method" => "append", :partial => "user_event_fields", :class => "btn" do
              %i.icon-plus
              Add new event
    
            %p.help-block
              %strong Please note:
              Events are only removed after confirming the changes with
              %span.label
                %i.icon-ok
                Update settings!
    
            = f.button :submit, :class => "btn" do
              %i.icon-ok
              Update settings!
    

    /app/views/users/_user_event_fields.html.haml:

    %tr.nested-fields
      %td= f.input_field :date, :as => :date_month_year, :class => "tooltip-bottom input-small", :rel => "tooltip", :title => "Date of event", :disabled => params[:action] == "show"
      %td= f.input_field :description, :placeholder => "Description", :class => "input-large tooltip-bottom", :rel => "tooltip", :title => "Description of event<br/>Use <strong>Markdown</strong> to format your text.", :disabled => params[:action] == "show"
      %td= f.input_field :label, :placeholder => "Label", :class => "input-medium tooltip-bottom", :rel => "tooltip", :title => "Label of event", :disabled => params[:action] == "show"
      %td= f.input_field :label_class, :collection => [["Green", "label-success"], ["Yellow", "label-warning"], ["Red", "label-important"], ["Blue", "label-info"], ["Black", "label-inverse"]], :include_blank => "Grey", :class => "input-small tooltip-bottom", :rel => "tooltip", :title => "Label color of event", :disabled => params[:action] == "show"
      %td
        = link_to_remove_association f, :class => "btn" do
          %i.icon-remove
    

    Please note that the .nested-fields class on the tag is essential for the remove link to work.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.