0

rails select 字段,带有 jquery multi select 在 rails 中不起作用。当我们选择多个选项并保存时,它只显示单个选项被选中(并非所有选定的选项都显示。)

我有以下选择字段,

    <div class="form-group">
      <label>In which form the funds are held?  </label></br>
      <%= f.select :form_of_funds__c, options_for_select(['Savings account', 'Fixed deposit','Sale of property'], @entrepreneur.form_of_funds__c), {class: "form-control", prompt: "Please select"},{ :multiple => true, :size => 5 } %>          
    </div>

和以下jquery逻辑。

  $(document).ready(function() {
   $('#cp_entrepreneur_form_of_funds__c, 
     #cp_entrepreneur_funds_held_on__c').multiselect({
     numberDisplayed: 4
   });
   });

下面是 Rails 服务器日志。

Started PATCH "/investor_create_or_update" for ::1 at 2019-01-02 12:30:27 +0530
DEBUG: Chewy strategies stack: [2] <- atomic @ /home/prashanth/.rvm/gems/ruby-2.3.1/gems/chewy-0.8.2/lib/chewy/railtie.rb:16
Processing by InvestorVisaController#investor_create_or_update as JS
  Parameters: {"utf8"=>"✓", "cp_entrepreneur"=>{"access_to_at_least_aud_40_000__c"=>"", "total_net_worth__c"=>"", "source_of_the_funds__c"=>"form-control", "funds_be_legaly_transferred_to_australia__c"=>"", "form_of_funds__c"=>["", "Savings account", "Sale of property"]*, "funds_held_on__c"=>["", "Main applicant (you)", "your spouse"],* "value_of_total_assests__c"=>"", "what_is_the_reason_for_applying_for_the__c"=>"", "status_of_property__c"=>"", "do_you_have_stable_and_regular_resources__c"=>"", "provide_evidence_for_lawful_source__c"=>""}, "commit"=>"Save and Continue"}
SET Action : investor_visa_investor_create_or_update
  User Load (0.2ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1836]]
  CP::Entrepreneur Load (2.1ms)  SELECT  "booking_informations__c".* FROM "booking_informations__c" WHERE "booking_informations__c"."primary_email_id__c" = $1 LIMIT 1  [["primary_email_id__c", "test_server4564645@gmail.com"]]
Unpermitted parameters: form_of_funds__c, funds_held_on__c
   (0.2ms)  BEGIN
  SQL (0.7ms)  UPDATE "booking_informations__c" SET "access_to_at_least_aud_40_000__c" = $1, "source_of_the_funds__c" = $2, "funds_be_legaly_transferred_to_australia__c" = $3, "status_of_property__c" = $4, "provide_evidence_for_lawful_source__c" = $5 WHERE "booking_informations__c"."heroku_id" = $6  [["access_to_at_least_aud_40_000__c", ""], ["source_of_the_funds__c", "form-control"], ["funds_be_legaly_transferred_to_australia__c", ""], ["status_of_property__c", ""], ["provide_evidence_for_lawful_source__c", ""], ["heroku_id", 2]]
   (14.6ms)  COMMIT
4

0 回答 0