Sha256: c841d1bca82745812a2f325a88a627df930ac4398df6ee718ac5758cb14d09f0

Contents?: true

Size: 1.63 KB

Versions: 16

Compression:

Stored size: 1.63 KB

Contents

module Formtastic
  module Inputs

    # Outputs a simple `<input type="hidden">` wrapped in the standard `<li>` wrapper. This is
    # provided for situations where a hidden field needs to be rendered in the flow of a form with
    # many inputs that form an `<ol>`. Wrapping the hidden input inside the `<li>` maintains the
    # HTML validity. The `<li>` is marked with a `class` of `hidden` so that stylesheet authors can
    # hide these list items with CSS (formtastic.css does this out of the box).
    #
    # @example Full form context, output and CSS
    #
    #   <%= semantic_form_for(@something) do |f| %>
    #     <%= f.inputs do %>
    #       <%= f.input :secret, :as => :hidden %>
    #     <% end %>
    #   <% end %>
    #
    #   <form...>
    #     <fieldset>
    #       <ol>
    #         <li class="hidden">
    #           <input type="hidden" id="something_secret" name="something[secret]">
    #         </li>
    #       </ol>
    #     </fieldset>
    #   </form>
    #
    #   form.formtastic li.hidden { display:none; }
    #
    # @see Formtastic::Helpers::InputsHelper#input InputsHelper#input for full documentation of all possible options.
    class HiddenInput 
      include Base
      
      def input_html_options
        super.merge(:required => nil).merge(:autofocus => nil)
      end
      
      def to_html
        input_wrapping do
          builder.hidden_field(method, input_html_options)
        end
      end
      
      def error_html
        ""
      end
      
      def errors?
        false
      end
      
      def hint_html
        ""
      end
      
      def hint?
        false
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/formtastic-4.0.0/lib/formtastic/inputs/hidden_input.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/formtastic-4.0.0/lib/formtastic/inputs/hidden_input.rb
formtastic-4.0.0 lib/formtastic/inputs/hidden_input.rb
formtastic-4.0.0.rc1 lib/formtastic/inputs/hidden_input.rb
formtastic-3.1.5 lib/formtastic/inputs/hidden_input.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/formtastic-3.1.4/lib/formtastic/inputs/hidden_input.rb
formtastic-3.1.4 lib/formtastic/inputs/hidden_input.rb
formtastic-3.1.3 lib/formtastic/inputs/hidden_input.rb
formtastic-3.1.2 lib/formtastic/inputs/hidden_input.rb
formtastic-3.1.1 lib/formtastic/inputs/hidden_input.rb
formtastic-3.1.0 lib/formtastic/inputs/hidden_input.rb
formtastic-3.1.0.rc2 lib/formtastic/inputs/hidden_input.rb
formtastic-3.1.0.rc1 lib/formtastic/inputs/hidden_input.rb
formtastic-3.0.0 lib/formtastic/inputs/hidden_input.rb
formtastic-3.0.0.rc2 lib/formtastic/inputs/hidden_input.rb
formtastic-3.0.0.rc lib/formtastic/inputs/hidden_input.rb