表单
form_tag({:controller => "projects",:action => "index",:id=>""},:id => 'form_id' )
文本框:
text_field("name" ,"test",:size => 20,:class => '',:value=>'',:maxlength => 5)
f.text_field(:name,:size => 20,:class => '',:value=>'1',:maxlength => 5)
生成HTML:
<input id="name" maxlength="5" name="name[test]" size="20" type="text" value="" class = ""/>
单选按钮
radio_id = 0
radio_button_tag(:select_button, "0", (0==radio_id), :id => "day_button",
nclick => "getDate()", :checked => (0 == radio_id))
radio_button_tag(:select_button, "1", (1==radio_id), :id => "month_button",
nclick => "getDate()", :checked => (1 == radio_id))
多选框
check_box_tag("user_cbox_i","code")
隐藏
hidden_field("hidden_button","clear",:value =>"")
php?name=%C8%D5%C6%DA" onclick="tagshow(event)" class="t_tag">日期:
select_date(nil, :field_name => 'birth',:include_blank => true,:default => nil,:use_month_numbers => true )
效果:日期的默认值为空白,月的表示为数字
设置开始年和终了年 :start_year => 1992, :end_year => 2007
select_year(@year_cond, :include_blank => true, :default =>nil, :start_year => 2005, :end_year => 2015)
分页
will_paginate( @projects ,:prev_label=> '前页',:next_label=> '后页')
删除
link_to '削除', calendar, :confirm => 确定删除吗?", :method => :delete
提交
submit_tag "提交",
nclick => "checkDate()"
f.submit "提交"