Hello there! This is my second post and I'm only in my second week of programming, so please bear with me.
I've got a group of checkboxes that act as different search filters which I'd like to pass to params. For instance, if it was a restaurant search, I'd want users to tick off the types of cuisine they're interested in just like Yelp.
All I want to do is update the parameters each time someone clicks an option. I'm not concerned about AJAX right now (I'll deal with that later).
Can I achieve this using an observe_form even without utilizing AJAX? Would JavaScript work for this purpose? I've read about "event handlers" but I don't really understand what they are. I hate to admit defeat and ask for help, but after working for 19 hours straight, I can't handle any more. Thank you!
CODE: (CORRECTED FOR A TYPO)
<div id="cuisine_form_div">
<% form_tag(hotels_path, :method => "GET", :id => :cuisine_form ) do %>
<%= check_box_tag('my_cuisine[]', 'Mexican', :onclick => "document.cuisine_form.submit();" ) %>
<%= label_tag(:my_cuisine, "Mexican", :onclick=>"document.cuisine_form.submit();") %>
<%= check_box_tag('my_cuisine[]', 'Delis') %>
<%= label_tag(:my_cuisine, "Delis") %>
<%= submit_tag 'update' %>
<% end %>
</div><!--end.id="cuisine_form_div"-->
Whenever I insert JavaScript like above, the checkbox gets pre-checked on the screen but doesn't send any information to the URL when clicked. If I manually click the submit button, everything works fine, but the URL won't change when using "onclick".