Update partial render form fields

Hi i have the following problem. I followed the screen cast to create
complex forms from railscats so i create a partial view for my
equipments list, so the client can add several different equipments, I
also made another view in case looking for the equipment inside the
select box. When i choose a equipment from the view (find_equipment) i
created there is no problem when there is only one equipment inside
the client form, but when I another equipment and I try to select it
from the select view (find_equipment) it does not update the select
box it should, it update the first select box.

I have a similar problem with observe_field, it should update the
properties for a certain product, but it only update the first select
list the other lists are not updated.

Here is the source code:

_equipment_services.html.erb

<% fields_for "voip[equipments_services_attributes] []",equipment_services do |e|%>

Información Equipos

Activo Fijo < %=e.select("equipment_id",Equipment.find(:all,:conditions=>"estado=6",:order=>"numero_activo_fijo").collect{| p|[p.numero_activo _fijo, p.id]},:index=>nil)%>

    <% if equipment_services.new_record? %>
      <%="Estado Activo"%>  <%=e.hidden_field("estado",:value=>6)

%>
<%= link_to_function “Eliminar”,
“this.up(’.equipment’).remove()” %>
<%else%>
<=% link_to_function “Eliminar”,
“mark_for_destroy(this,’.contact’)” %>
<%= e.hidden_field(:id,:index=>nil) %>
<%= “Estado” %>
<%=
e.select(“estado”,Code.find(:first,
:conditions=>[“id=5”]).elements.collect{|
p| [p.descripcion,p.id]},:index=>nil) %>
<%=
e.hidden_field(:should_destroy,:index=>nil, :class=>“should_destroy”)
%>
<%end%>
<%=link_to “Crear Nuevo
Equipo”,add_equipment_equipment_path,:popup =>
[“Agregar_Nuevo_Equipo”,“height=600, width=700”]%>
<%= link_to “Buscar Equipos”,
{:action=>“find_equipment”, :controller=>“show_select”}, :popup =>
[“Show_Equipment”,“height=60
0, width=700”]%>

<%end %>

javascript function
function set_value(id,value)
{
opener.document.getElementById(id).value=value;
window.close();
}

find_equipment.html.erb

<% form_tag find_equipment_show_select_path, :method=>"get" do%> <%end%> <% switch=false for equipment in @equips %> <% switch=!switch %>"> <% end %>
Buscar Usuario: <%=select_tag "busqueda","ModeloNúmero Activo FijoNúmero SerieDirección MAC"%> <%=text_field_tag :search, params[:search]%> <%=submit_tag "Buscar", :name=>nil%>
Modelo Marca Activo Fijo Número de serie Tipo Equipo
<%=equipment.modelo%> <%=Code.getDescripcion(equipment.marca)%> < %=link_to_function("#{equipment.numero_activo_fijo}","set_value('voip_equipments_services_attributes__equipment_id','#{equi pment.id}')")%> <%=equipment.numero_serie%> <%=Code.getDescripcion(equipment.code_id)%>

Can anyone help me please? i’m kind of lost here

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs