select_tag:
<%= select_tag("article[type_id]", options_for_select([["请选择",nil]]+ArticleType.all.map{|t| [t.name, t.id]}, :selected=>record.type_id))%>
select 中的 :selected 值 要与 values里类型一致
<%= select_tag("article[type_id]", [["请选择",nil]]+ArticleType.all.map{|t| [t.name, t.id]}, :selected=>record.type_id)%>
或是写到help层 (更有效)
view
<%=ongoing_material_select 'material[][material_id]',f.material.id %>
help
def ongoing_provider_select name,selected,js_function=nil
select_tag name,
options_from_collection_for_select(Provider.ongoing_provider, "id", "name", selected),
{:include_blank=>'None', "onchange"=>"javascript:#{js_function}"}
end
select :
select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, { :include_blank => true })
<select name="post[person_id]">
<option value=""></option>
<option value="1" selected="selected">David</option>
<option value="2">Sam</option>
<option value="3">Tobias</option>
</select>
prototype.js
<%= text_field_tag 'product[no]',{}, :onchange => remote_function(:update => "no_result",
:method => "get",
:with => "'no=' + value",
:url => { :controller => :product, :action => :is_show})
%>
<span id="no_result"></span>
<%= select :obj, :att, @items, {}, :onchange => remote_function(:update => "sub_items",
:method => "get",
:with => "'item=' + value",
:url => { :controller => :home, :action => :get_sub_items})
%>
<%=select_tag ( 'product[style_id]',options_for_select([["未选择",0]]+Style.find(:all).map{|t| [t.name, t.id]}),
:onchange => remote_function(:update => "sub_items",
:method => "get",
:with => "'style_id=' + value",
:url => { :controller => :product, :action => :get_pic_look}) )%>
<%=link_to_remote '删除',:update=>'mpart_table',
:url=>{:controler=>:product,:action=>:del_row_mpart,:id=>mpart.id},
:confirm=>"删除部件分同时删除部件详情?"%>
分享到:
相关推荐
| |/ // // /____/ // /___/ /_/ / /_/ / |___/___/\____/___/_____/\____/\____/ Vicilog v eq_v // Changelog / Buildtool https://github.com/dn5/vicilog Use argument --help for ...
Atom-ide-ruby.zip,Atom package used to integrate https://github.com/kwerle/ruby_language_server with Atom. Development happens on the develop branch. Production is master.概述,atom是一个用web技术构建...
Redmine 搭建 Ruby_Ruby_on_Rails 项目管理系统
Beginning_Ruby_From_Novice_to_Professional.pdf
ruby_1_9_3_stdlib这一份是ruby的标准库,相当于类库
ruby_on_rails_3_入门教程(中文)
SignalFx的Ruby客户端库_Ruby_Shell_下载.zip
RUBY on SaaS 高级软件工程第二次作业代码
ruby短信接口开发_ruby发送短信验证码通知_ruby短信demo示例.docx
ruby_user's_guide
ruby_1_9_3_core_rdocs.gz Ruby开发文档
ruby_1_8_6_core_rdocs.tgz 包含ruby的标准库文件 类和方法
ruby_1_9_3_stdlib_rdocs.gz ,Ruby最新开发文档
Google距离矩阵API的Ruby客户端。_Ruby_下载.zip
到 ___ ______ ____ _ _ ___ / \ \ / / | / | | ___ _ _ | | / _ \ / _ \ \ / \ / / _ \ | | | | / _ | | | | / `| ( )| / ___ \ VV / )| | | | | ( )| | | | ( | | _ ,| / / __ / _ / | / _ | | ___ / _ , ...
ruby_on_rails_创建一个博客项目.doc
在Scala和Ruby中实现的稳定婚姻问题变体_Ruby_Scala_源码_下载.zip
___ ___ __ __ _ _ __ (_) ___ _ __ ___ ___ ___\ \ / / '__|/ _` | '_ \| | / __| '_ \ / _ \/ __/ __| \ V /| | | (_| | |_) | | \__ \ |_) | __/ (__\__ \ \_/ |_|___\__,_| .__/|_|___|___/ .__/ \___|\___|___/...
学习Ruby的脚本实例 class_all.rb 累积一些总是用到的公共类 /cj /my_script.rb 长江学者页面抓取,并放入CSV文档里 /cctv/my_scrip.rb 从百度百科抓取CCTV年度经济人物,解析,然后手动改部分 nx.rb将部分列调换...
___ /___________ /__ _ __/ __ \ __/ /_/ / /_/ /_/ / / / ,\ \__/\____/_/ /_/|_\ >>>------> 代码: : 文件: : 错误: : 用叉子测试 当测试改变时,Tork会并行运行您的测试: 将测试执行开销...