Rails 表单总结
1、button
<%= button_to "删除",{:controller =>"welcome",:action =>"delete",:id =>@s[:s_id]},:class=>"class",:confirm =>"确定删除?"%> //"删除"--按钮显示文字 //":id"--传递参数 //":class"--css式样 //":confirm"--删除操作前的确认框
2、label
<%= label_tag(:label_id,"内容") %> //":label_id"--label的id //"内容"---label显示文字
3、radioButton组
<%= radio_button_tag :users,'a',false%><%= radio_button_tag :users,'b',false%> //不以数组做name//radio_button_tag(name, value, checked = false, options = {}) //控制器中接受数据代码如下 params[:users] == "a" //a被选中
4、checkbox组
<%= check_box_tag 'stories[]', s[:id],false%> //数组做name//check_box_tag(name, value = "1", checked = false, options = {})//控制器中接受数据代码如下 params[:stories]
5、link
<%= link_to "首页",:controller =>"welcome",:action =>"index" %>
6、text
<%= text_field_tag(:name,"请输入数据") %>