Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

162
Vistas
I'm trying to inject a form after that the user respond to a form inject the second one in rails using js.erb

I make a complex form and I want to have a more responsive web site:I put the second form in as a partial form after the user has submitted the first. If I inject a partial that has only normal HTML p, h1, a: it works, but when I try to inject rails helper form it doesn't work

this is the part that intends to inject the form:

define_list_of_bands.js.erb

$('#output_combo').html("<%= render :partial => 'input_combo_speed' %>");

_input_combo_speed.html.slim

= form_with scope: 'combo_input', url: combo_speed_path, remote: true do |form|
    .row
    .col.s6
        ul.collapsible
            #body
                li
                .collapsible-header.active
                    h4 LTE Bands
                - (@spectrums.select{|i| i[:nr_lte]=="LTE" }).each_with_index do |element, index| 
                    = form.check_box element[:value]
                    = "In band:-- " + element[:name]+ + "--, " + element[:bandwhith].to_s + " MHz :   ( " + element[:block] +  "   ) "
                    br
    .col.s6
        ul.collapsible
            #body
                li
                .collapsible-header.active
                    h4 NR Bands
                - (@spectrums.select{|i| i[:nr_lte]=="NR" }).each_with_index do |element, index| 
                    = form.check_box element[:value]
                    = "In band:-- " + element[:name]+ + "--, " + element[:bandwhith].to_s + " MHz :   ( " + element[:block] +  "   ) "
                    br
    .row
        = form.submit "Calculate", class: 'btn blue'

speed_controller.rb

    def define_list_of_bands
      # creat the list for checboxes at preview_combo form 
      @spectrums = []
      bands.each do |band|
        result = contuguous_services.get_contiguous_spectrum_in_band(comp_spectrums,band)
        result.each_with_index do |spectrum,index|
          if spectrum.bandwhith > 0
            @spectrums.append( 
             { 
            nr_lte: band.nr_lte,
            value: "#{band.name}_#{band.nr_lte}_#{band.duplexing}_#{spectrum.bandwhith}_#{index}_#{request_params[:city_id]}", 
            name: band.name,
            bandwhith: spectrum.bandwhith,
            block: spectrum.block,
             })
          end
        end
      end
      respond_to do |format|               
        format.js
      end 

Any help would be greatly appreciated. Thanks!

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda