浏览 298 次
|
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
|---|---|
| 作者 | 正文 |
|
最后更新时间:2008-03-31
.erb
<%= f.select :come_from,
CustomerOut::FROM,
{:prompt => CustomerOut::FROM[0][1]}, :onchange => remote_function(:update => "time_now",
:with => "'username='+$('customer_out[username]').value + '&come_from='+$('customer_out[come_from]').value",
:url =>{:action => 'check_customer'},
:before => "$('search_customer').innerHTML = '搜索中...';",
:complete => "$('search_customer').innerHTML = '';"
) %>
<div id="time_now"></div>
.rb def check_customer
@customer_out = CustomerOut.find(:first, :conditions => ["username = ? and come_from = ?", params[:username], params[:come_from]])
if @customer_out
@consignee = @customer_out.customer.consignees.find(:first)
else
@customer_out = CustomerOut.new
@customer_out.username = params[:username].strip
@customer_out.come_from = params[:come_from]
end
render :text => Time.new.to_s
end
(还不会对<input>更改) 声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |


