如何根据所选值填充表单的字段?

时间:2016-04-01 09:55:59

标签: ruby-on-rails activeadmin

我在activeadmin中创建了一个表单,如下所示。当我选择客户的bkid时,必须在表单中自动填写字段customer namemobile numbertotal amountamount 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实现此目的?

0 个答案:

没有答案