Checkboxes patently refuse to submit information onclick- HELP

Hi this is my second post (and second week programming, ever) so apologies in advance. I have a list of checkboxes that represent different search filters that I want passed to params. For example, if this were a restaurant search, I would want my users to be able to check off different types of cuisine that they are interested in. Just like Yelp. All I want to do is to send the new parameters each time someone clicks on an option. I DON'T care about AJAX right now (I'll cross that bridge when I come to it). Can i do this with an observe_form even though I'm not using AJAX? Can I use javascript? I've seen stuff about "event handlers" but i have no idea what those are. I hate to give up and ask but i've now been working for 19 hours and I can't handle anymore. Thanks! CODE: (UPDATED FOR TYPO)
<% 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 %>
--- Note that whenever I insert the javascript like above, it prechecks the box on the screen but doesn't submit any info to the URL. If I click the submit button, everything works great, but "onclick" I can't get the URL to budge.

以上就是Checkboxes patently refuse to submit information onclick- HELP的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏