I have a select tag with 2 options :
select_tag :type, options_for_select("<option value = 'produit1'>Produit1</option><option value = 'Produit2'>Produit2</option>", params[:product]), id: "different_option_value_html", onchange: "this.form.submit();", include_blank: "Which products ?"
When one of this options are selected, the form is automatically submit. I would like to keep the params in first position. I mean visible without clicking on the select, at the place of "which products".
include_blank: params[:product]
? – Clatternil
or empty string? – Clatterparams[:product]
, maybe you wantparams[:product][:name]
or something. Debug the value ofparams[:product]
and make sure it is there – Clatter{ include_blank: params[:product] }
– Clatterselect_tag :type, options_for_select("<option value = 'produit1'>Produit1</option><option value = 'Produit2'>Produit2</option>", params[:product], selected: params[:product]), id: "different_option_value_html", onchange: "this.form.submit();", include_blank: "Which products?"
– Clatter