简体   繁体   中英

how to add Active Admin form input :html {multiple => “”}?

ActiveAdmin form:

my problem: I can not get a form with multiple choice files(

I tried:

      ActiveAdmin.register Foto do: 
       form :html => { :multipart => true } do |f|
         f.inputs "Upload" do
          f.input :foto, :as => :file
         end
         f.actions
       end
      end

this does not work, then I made a simple html page with two forms:

    <!DOCTYPE doctype html>
    <html>
     <head>
     </head>
     <body>
      <!--**not** work multiple choice files-->
      <form accept-charset="UTF-8" action="#" enctype="multipart/form-data" method="post">
        <input id="image" name="image" type="file"/>
      </form>

      <!--**great** work multiple choice files-->
      <form accept-charset="UTF-8" action="#" method="post">
        <input id="image" name="image" type="file" multiple=""/>
      </form>

     </body>
    </html>

Question: how to add a property to multiple input field ?

I tried:

     f.input :foto, :as => :file, :html => {:multiple => ""}
     f.input :foto, :as => :file, :html => {:multiple => ""}
     f.input :foto, :as => :file, :html => {"multiple" => "multiple"}
     f.input :foto, :as => :file, :html => {:multiple => :multiple}

this does not work

help me, please.

你应该用

f.input :foto, as: :file, input_html: { multiple: true }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM