Complex Form

I’m rending a form of a table in a partial. The rows can be adjusted
dynamically. How do I write
1
2
3
4
5
??

<%= render :partial => ‘round’, :collection => @game.rounds %>

<% fields_for_round(round) do |round_form| %> <%= ROW??? %> <% end %>

if all you want is the count for the current partial being rendered
you have it in round_counter

http://ap.rubyonrails.com/classes/ActionView/Partials.html

Hi.

You’re rendering a form of a table in a partial.

Tables don’t have forms.

Do you mean a form for some data in a DATABASE table?

That doesn’t make sense, either.

perhaps you mean you’re rendering a form for a MODEL which is relying
on data in a database table?

If that’s the case, that’s fine.

Now, you say the rows can be adjusted dynamically.

Do you mean the rows can be adjusted by the user, when they’re looking
at the page, using AJAX?

Or do you mean they’re programmatically driven?

what does: how do I write 1 2 3 4 5 … mean?

Do you mean how do I write the numbers from 1 to some arbitrary number?

Or do you mean how do I label my rows, given a varying number of
records to be displayed, or something else?

BE MORE SPECIFIC! GET CLEAR!

Do you understand why I’m being like this, now?

Programming is a specific art, and you need to be very clear in your
mind if you want to understand the reason things happen the way they
do and fundamentally understand what processes are going on underneath
“the hood” so to speak.

I’m saying this because I care. Most people on this list will just
look at your questions and treat them like rubbish, because it’s too
hard to grok what you’re attempting to ask from your “Question”.

You can do this, I know you can - clearly write out your requirements
for us so we can help you with them. Specify every little detail -
exactly what you want to accomplish.

Julian

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #3 out NOW!
http://sensei.zenunit.com/

Okay. I’ve got it now. You’ve been very helpful thanks.

Actually I was asking these questions to gather responses from you so
we can further help…

If you respond to the questions, then we can potentially get to the
bottom of solving your issue(s).

Sorry if I’m coming across as narky. I think I need more sleep, and
less coffee.

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #3 out NOW!
http://sensei.zenunit.com/

edit game

<% form_for :game, :url => school_team_game_url(School.find(current_user.school_id), Team.find_by_user_id(current_user), @game), :html => { :method => 'put' } do |f| %> <%= render :partial => 'fields', :locals => { :f => f } %>

<%= submit_tag "Submit Game" %>

<% end %>

  <%= render :partial => 'round', :collection => @game.rounds %>

<% fields_for_round(round) do |round_form| %> <% @class = cycle("", "alt", :name => "colors") -%> <% 3.times do |p| %> <%= round_form.select(:action, ["Miss", "Skip", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]) %> <%= round_form.hidden_field :player_id, :value => Team.find_by_user_id(current_user).players[p].id %>

#<%= round_form.hidden_field :row_id, :value => round_counter + 1 %></
td>
#it keeps repeating 2 every time i hit Add Round. It needs to keep
counting up!

<% end %>

<%= round_counter + 1 %>

<% 3.times do |p| %>

<%= round_form.select(:action, [“Miss”,
“Skip”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”]) %>
<%= round_form.hidden_field :player_id, :value =>
Team.find_by_user_id(current_user).players[p].id %>
<% end %>
<% end %>