Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form Fieldtype "Files" errors "The Files Field must be an array" on sending #396

Closed
stefankempf opened this issue Aug 26, 2024 · 6 comments

Comments

@stefankempf
Copy link
Contributor

Bug description

When I use a fields fieldtype inside my forms (either max files set to n or null), the form can't be send.

Screenshot von 2024 08 26 um 17 41 49@2x

I've tried on a fresh peak install with max files set to 1 or also null.

The error is similar to this issue: #366 only difference to the other issue: when I use the asset fieldtype, the error is not showing.

How to reproduce

Use fresh peak install, add Files Field to existing form blueprint and try to send the form.

Logs

storage/logs/laravel.log is empty 🤷‍♂️

Environment

Environment
Application Name: Peak
Laravel Version: 11.20.0
PHP Version: 8.3.9
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Statamic
Addons: 4
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.22.0 PRO

Statamic Addons
studio1902/statamic-peak-browser-appearance: 3.5.0
studio1902/statamic-peak-commands: 8.4.2
studio1902/statamic-peak-seo: 8.15.3
studio1902/statamic-peak-tools: 6.3.2

Additional details

No response

@robdekort
Copy link
Contributor

I'm just noticing there's now an assets field and a files fieldtype? It's the latter one you're working with? What is the difference with the assets field? Do you know? Trying to understand what's going on here.

@robdekort
Copy link
Contributor

The files fieldtype doesn't have a published view in Peak. As I never knew it existed and also don't understand what it does as opposed to the asset fieldtype.

What if you create a view for this and replicate the logic that Peak ships for the asset fieldtype. Does it work then?

@robdekort
Copy link
Contributor

Ah ok, so this is what it's for: statamic/cms#9084

I'd just duplicate the assets view and call it files.antlers.html. Please let me know if that solves it. If so I can ship it by default.

@robdekort
Copy link
Contributor

You can probably also just put this into files.antlers.html:

{{ partial:vendor/statamic/forms/fields/assets }}

@stefankempf
Copy link
Contributor Author

stefankempf commented Aug 28, 2024

I'm just noticing there's now an assets field and a files fieldtype? It's the latter one you're working with? What is the difference with the assets field? Do you know? Trying to understand what's going on here.

Yeah I'm working with the files fieldtype. Its the same like the asset fieldtype with the only difference, that the asset is not getting stored – only sent by mail. I have a customer with exactly that requirement where I was pretty happy to find out, that this is already possible out of the box with statamic.

I'd just duplicate the assets view and call it files.antlers.html. Please let me know if that solves it. If so I can ship it by default.

Me saying "Its the same like the asset fieldtype" could have already brought me the idea myself, that I could simply reference the assets fieldtype in 'files.antlers.html'. Sorry for not thinking along, was a long day on monday.
Nevertheless, like you already implemented in 19.8., the referencing approach works fine, as far as I was able to test. Will work on my form setup some more in the upcoming days and if I see anything else, I'll let you know.

@robdekort
Copy link
Contributor

No worries and good to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants