Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!