【问题标题】:Getting radio button selection using Rails使用 Rails 获取单选按钮选择
【发布时间】:2012-03-10 10:46:47
【问题描述】:

我正在显示一个单选按钮表,每个单选按钮对应一个具有唯一 ID 的食谱。我正在使用提交标签来准确提交按下了哪个单选按钮,表明选择了哪个配方。我正在尝试将 id 传递给我的控制器以进行一些查询/表单字段。实际上,我在传递 id 时遇到了麻烦。有人可以帮帮我吗,我是 Ruby 新手?谢谢!

<%= form_tag(:action => 'chooseOption') do %>
<%= submit_tag("Show Recipe", :class => 'action show') %>
<%= submit_tag("Delete Recipe", :class => 'action delete') %>

<td><%= radio_button_tag 'recipe', recipe, @recipe == recipe %></td>
  <td>recipe.recipe_name</td> 
  <td>recipe.total_calories</td> 
  .....all the other fields
</td>

【问题讨论】:

    标签: html ruby-on-rails controller radio-button


    【解决方案1】:
    猜你喜欢
    • 2013-09-28
    • 2015-03-28
    • 2012-12-15
    • 1970-01-01
    • 1970-01-01
    • 2014-03-14
    • 2017-11-25
    • 2011-08-04
    • 1970-01-01
    相关资源
    最近更新 更多