我在activeadmin
中创建了一个表单,如下所示。当我选择客户的bkid
时,必须在表单中自动填写字段customer name
,mobile number
,total amount
和amount paid
。
form :class => 'form_inline' do |f|
f.inputs do
f.input :bkid, :label => 'Booking Id', :as => :select, :collection => Package.all.map{|u| ["#{u.bkid}"]}
f.input :firstName, :as => :string, :label => 'First name', :class => 'same'
f.input :lastName, :as => :string, :label => 'Last name', :class => 'same'
f.input :mobile, :as => :string, :label => 'Mobile no', :class => 'same'
f.input :totalAmount, :as => :string, :label => 'Total Amount', :class => 'same'
f.input :amountPaid, :as => :string, :label => 'Amount Paid', :class => 'same'
f.input :currentPayment, :as => :string, :label => 'Current Payment', :class => 'same'
# f.input :accountcode_id, :label => 'Acc_code', :as => :select, :collection => Accountcode.all.map{|u| ["#{u.accountcode}, #{u.accountname}"]}
br
f.submit :value => 'submit'
end
end

如何使用ajax实现此目的?