Hi,
I have a dropdown menu which shows the categories available. When a user
selects one I want the browser to redirect to the selected category.
I now have this code I found on stackoverflow;
<%form_for :cat_form, :url => {:action => :viewflokkur_selected} do
However, "value" appears to be null everytime, so I get thrown to
http://localhost:3000/categories/viewflokkur/null. Is there something I
need to do for this to work, or should I be doing something else? I
don't really understand how to use observer_fields either, but that
seems to be something I should be looking into, is it not?
this.getAttribute("value") won't work on a select input, since the
select doesn't have a "value" attribute. Rather, it has a list of
options, and one or more of them are selected.
this.getAttribute("value") won't work on a select input, since the
select doesn't have a "value" attribute. Rather, it has a list of
options, and one or more of them are selected.
That gave me params[:id] = index-selected, so I created this new method
viewflokkur_from_select wich gets @cats_for_mt[params[:id].to_i-1] and
then redirects to viewflokkur with that value as params[:cat]. Not very
pretty, and a whole lot uglier than I expected, but works...