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!