Reputation: 4578
I have a <select>
tag I am creating with the rails select_tag
and I am populating its contents in JS. So i would like to initialize it to be empty, but when I write.
= select_tag "program", "<option></option>".html_safe, include_blank:true
I get the following error:
app/views/welcome/index.html.haml:53: syntax error, unexpected ';', expecting ')' ));}\n #{_hamlout.format_scri... ^
Here is my full form, which may be causing the error:
=form_tag(controller: "school_applications", action: "calculate_price", method: "get", class: "calc_form") do
=select_tag "start_date", options_for_select(['February 9, 2015', 'April 6, 2015', 'May 4, 2015', 'June 1, 2015', 'June 29, 2015', 'July 27, 2015', 'August 25, 2015', 'September 21, 2015', 'October 19, 2015', 'November 16, 2015', 'December 14, 2015' ])
-@option_array = (2..52).each.map {|i| ["#{i} weeks", i]}
-@option_array = @option_array.unshift(["1 week", 1])
= select_tag(:duration,options_for_select(@option_array))
= select_tag(:fls_center,options_for_select( FlsCenter.all.map{|p| [p.name, p.id]})
= select_tag "program", "<option></option>".html_safe, include_blank:true
=submit_tag "Calculate Price"
Upvotes: 0
Views: 200
Reputation: 1567
you need one more )
at the end of line 52
=select_tag(:fls_center, options_for_select(FlsCenter.all.map{|p| [p.name, p.id]}))
Upvotes: 1