Hi!
I'm developing an application with Rails 1.2.6 and I've facing a weird problem.
In a form, I'm using link_to_function that is aggregating a :partial, the code is as follows: <table> <thead> <tr> <th>Marca</th> <th>Porcentaje</th> <th>Objetivo Mensual</th> <th>Destino</th> </tr> </thead> <tbody id="bonificaciones"> <%= render :partial => 'bonificacion', :collection => @convenio.bonificaciones %> </tbody> </table> <%= link_to_function 'Agregar Bonificacion' do |page| page.insert_html :bottom, :bonificaciones, :partial =>'bonificacion', :object => Bonificacion.new end %>
The :partial's code: <tr class="bonificacion"> <% fields_for "convenio[bonificaciones_attributes] ",bonificacion do |bonificacion_form| %> <td><%= bonificacion_form.collection_select :marca_id,@marcas, :alternate_id, :valor %></td> <td><%= bonificacion_form.text_field :porcentaje %></td> <td><%= bonificacion_form.text_field :objetivo_mensual %></td> <td><%= bonificacion_form.select :destino,Bonificacion::DESTINO %></td> <td><%= link_to_function "Quitar","try{this.up('.bonificacion').remove()} catch(e) {alert('JS error\\n' + e.name + '\\n' + e.message); throw e}" %></td> <td><%= link_to_function "this.up", "try{this.up(1)} catch(e) {alert('JS error\\n' + e.name + '\\n' + e.message); throw e}" %></td> <% end %> </tr>
The 1st link_to_function is using this.up('.bonificacion').remove() working w/o any problem with firefox and opera but not with internet explorer. Using try..catch and the alert found internet explorer doesn't recognize 'this.up' as a valid method, AFAIK is a prototype (Element.up) method but can not understand the reason for error. I used the second link_to_function serve to pinpoint the error to Element.up
Any help? recommendation? guidance? If any additional information is required, pls ask me.
Thank you in advance.
Saludos,
Martín Trejo Chávez