Hi all,
I'm very new to this community, and I started practicing with Ruby on
Rails just recently.
I watched the 3 episodes , 72-73-74 for complex forms on railscasts ,
and I'm trying to deploy a "new" function for my form based on what I
saw in the 3 episodes.
So, I have a form for my master table, with 2 fields: one is named
"from_pl" and the other is named "to_pl".
What I'd like to achieve is the possibility of adding (to_pl - from_pl)
children to the form with the click on a link.
So my model is perfectly shaped, and the link Add child , in the vein of
the referenced episode of railscasts is perfectly working, the code in
the new.html.erb is
<%= link_to_function "Add Child" do |page|
page.insert_html :bottom, :percentages, :partial => 'percentage',
:object => MatchPercentage.new
end %>
I'd like to add more than 1 child , and I tried with a loop.
So far, using
<%= link_to_function "Add Child" do |page|
3.upto(6) do
page.insert_html :bottom, :percentages, :partial => 'percentage',
:object => MatchPercentage.new
end
end %>
works fine. I'd like to substitute the 3 and the 6 with the values of
the 2 fields in the form, which has not yet been submitted.
I tried with a lot of different searches on the web, but didn't find
anything suitable.
Could you please enlighten me if there is a solution or not?
Thanks a lot, Kind regards
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---