Hello,
I have a simple link_to_function to add a group of form fiels, to use
observe_field I must have unique names...
I created a var to store the itens count but the partial is not
updating it's value.
****************************************************************************************************
_form.html.erb
<div id="products">
</div>
<% @count = 0 %>
<%= add_product_link "New product" %>
****************************************************************************************************
quotes_helper.rb
module QuotesHelper
def add_product_link(name)
link_to_function name do |page|
@atual = @atual + 1
page.insert_html :bottom, :products, :partial =>
"quote_product", :object => QuoteProduct.new
end
end
end
****************************************************************************************************
_quote_product.html.erb
<div class="product">
<% fields_for "quote[product_attributes][]", quote_product do |f| %>
<p>
<%= @count %>
<%= f.select :product_id, @products, {}, :index => nil,
:prompt
=> "Escolha uma opção..." %>
<%= f.text_field :quantity, :size => 12, :index => nil %>
<%= f.select :colors, 1..4, {}, :index => nil %>
<%= f.text_field :discount, :size => 12, :index => nil %
>
<%= @count = @count + 1 %>
</p>
<% end %>
</div>
****************************************************************************************************
Does anyone have any tip on it?
thanks
Luciano
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---