# Update partial render form fields

**URL:** <https://www.ruby-forum.com/t/update-partial-render-form-fields/132895>\
**Category:** Rails\
**Created:** [March 25, 2008, 5:15pm UTC](https://www.ruby-forum.com/t/update-partial-render-form-fields/132895 "2008-03-25T17:15:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darth\_timeus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f08c70/32.png) [@darth\_timeus](https://www.ruby-forum.com/u/darth_timeus)\
**Post date:** [March 25, 2008, 5:15pm UTC](https://www.ruby-forum.com/t/update-partial-render-form-fields/132895/1 "2008-03-25T17:15:26Z")

</div>

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
