Skip to content

Form might need more work - or I more instruction #501

Description

@wdiechmann

It is no doubt the latter in case - but anyways

I'm seeing

module Views
  #
  # the date component is a wrapper for the date_field form input field
  #
  class Components::Form::Form < Phlex::HTML
    include Phlex::Rails::Helpers::FormWith
    include Phlex::Rails::Helpers::HiddenField
    include Phlex::Rails::Helpers::TextField

    def initialize( resource: nil, css: "" )
      @classes = "h-full flex flex-col bg-white shadow-xl overflow-y-scroll #{@css}"
    end

    def template(&)
      form_with( model: @resource, url: helpers.resource_url(), id: helpers.resource_form, data: { form_sleeve_target: 'form' }, class: @classes) do |form|
        yield
      end
    end
  end
end

rendering

<form id="form_1" class="h-full flex flex-col bg-white shadow-xl overflow-y-scroll " data-form-sleeve-target="form" action="/employees/2/asset_work_transactions/34" accept-charset="UTF-8" method="post">
<input type="hidden" name="authenticity_token" value="vS4kIXJRMmYnur4VD3wSBaEMf5R02jGY1RYVAozUL9DS51qpOwV-ajw7Z75fzDp-KdJvvqPWgLoB895mLBCzZg" autocomplete="off">

</form>

whereas I'd expect it to render something along the lines of

<form id="form_1" class="h-full flex flex-col bg-white shadow-xl overflow-y-scroll" data-form-sleeve-target="form" enctype="multipart/form-data" action="/employees/2/asset_work_transactions/34" accept-charset="UTF-8" method="post">
  <input type="hidden" name="_method" value="patch" autocomplete="off">
  <input type="hidden" name="authenticity_token" value="vS4kIXJRMmYnur4VD3wSBaEMf5R02jGY1RYVAozUL9DS51qpOwV-ajw7Z75fzDp-KdJvvqPWgLoB895mLBCzZg"" autocomplete="off">
</form>
  • recognising the PATCH when editing
  • adding the enclose type enctype='multipart/form-data'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions