我在 Rails 2.x 中有这段代码:
<div class="label-field-pair">
<label><%= t('select_a_course_batch') %></label>
<div class="text-input-bg"> <%= select :fees_submission, :batch_id, @batches.map { |c| [c.full_name, c.id] },
{:prompt => "#{t('select_a_batch')}"},
{:onChange => "#{remote_function(:url => {:action => "update_fees_collection_dates_voucher"}, :with => "'batch_id='+value")}"}%> </div>
对于 onChange 操作.. 我想将哈希键 (c.fullname) 传递给远程 update_fees_collection_dates_voucher 控制器而不是哈希值 (c.id) .. 将“'batch_id='+value”替换为“'batch_id=' +key”似乎不起作用。有任何想法吗?谢谢!