How to use input control in loop

Hi everyone,

i am using a in a for loop. but not getting the
data as loop.
also in controller how i will fatch the data of that loop.

Here is my code.

<% for pros in @pros%>


<%=pros.name%>

add




0</
span>

<input type=“hidden” name=“txtpros” id=“txtpros<
%=pros.id%>” value=<%=pros.id%> >

<% end %>

Javascript:------

function addpros(theCount,txtpros,txtT)
{
if(parseFloat(document.getElementById(theCount).value) > 0){
document.getElementById(theCount).value = parseFloat
(document.getElementById(theCount).value)-1;
/document.getElementById(txtpros).value = parseFloat
(document.getElementById(txtpros).value)+1;
/
document.getElementById(theCount).innerHTML = parseFloat
(document.getElementById(theCount).innerHTML)+1;
document.getElementById(txtpros).innerHTML = parseFloat
(document.getElementById(txtpros).innerHTML )+1;
document.getElementById(txtT).value = parseFloat
(document.getElementById(txtpros).innerHTML );
}
}

Here, im generating a table row by loop, which has to assign a value
in each row by the input control.

when i inspect the element its gives.
puts params.inspect

{“commit”=>“Finish”, “captcha”=>"", “rating_overall”=>"",
“txtpros”=>“1”, “txtT”=>“1”,
“authenticity_token”=>“a5e1c967a1a70ddc4382dc6c0ff2342705e5e376”,
“action”=>“add_review”, “rating_terms”=>"", “controller”=>“managers”,
“rating_performance”=>"", “comment”=>{“body”=>""}, “rating_Team”=>"",
“rating_strategy”=>""}
here im getting single data.
but i need to get data from all rows.

could u plz help me as soon as possible.

Thanks,

On May 19, 7:06 am, nishi [email protected] wrote:

Hi everyone,

i am using a in a for loop. but not getting the
data as loop.
also in controller how i will fatch the data of that loop.

long version: take a peak at

or Parametrised to the max - Space Vatican

short version: Parameters need to be named appropriately (append [] to
the parameter name) for rails to handle them as arrays (rather than
ignoring duplicates)

Fred