Sha256: f9b90dfac89b7ab8915c0734c8c0803aef1aecd9087b82b976fe6b3ae9c3fecb

Contents?: true

Size: 485 Bytes

Versions: 3

Compression:

Stored size: 485 Bytes

Contents

require "formalist/child_forms/child_form"

module Formalist
  class Elements
    class FormField < ChildForms::ChildForm
      attribute :hint

      def fill(input: {}, errors: {})
        input = input[name]
        errors = errors[name].to_a

        super(input: input, errors: errors)
      end

      def to_ast
        [:form_field, [
          name,
          type,
          input,
          Element::Attributes.new(attributes).to_ast,
        ]]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
formalist-0.9.0 lib/formalist/elements/form_field.rb
formalist-0.8.0 lib/formalist/elements/form_field.rb
formalist-0.7.0 lib/formalist/elements/form_field.rb