views:

19

answers:

1

hi guys, this is what I wanna do. i need to have a select with options and javascript in each one,

**select...%>**
 <% @buscar.each do |j|%>
 <option value="<%= j.cedula_tutor1 %>" onclick="Datos2('j.cedula_tutor1');">
 <%= j.cedula_tutor1 %>
</option>
<%end%>
 **</select>**

this is what I has made in rails...

<%=select("cedula_tutor1", "nombre",Tutore.all.collect{|u| [u.cedula_tutor1,u.nombre_tutor1]},{}, {:onchange => "Datos2('j.cedula_tutor1'))"})%>,

of course that it's doesn't work becase the "j.cedula_tutor1" is outside the loop, how can I make it????, I just want to call a JS function giving the j.cedula_tutor as parameters... any suggestion?

A: 

you should extend your loop with it. or just make some class variable to access it via parent attribute of child instance. or something like caller.

Eugene