Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda