statamic-livewire-forms
statamic-livewire-forms copied to clipboard
500 when submitting form
Submitting a form throws: Undefined array key "first_name" (fails on first field)
Also when wire_model: live.debounce.150ms is set for a field in BP - same error when fields looses focus (validation related?).
Rootcause(?):
It looks like $this->submittableFields in vendor/aerni/livewire-forms/src/Livewire/Concerns/HandlesValidation.php:23 is empty.
After some digging it looks like for some reason with my setupdist/js/forms.js fails to set it (or even to add to Alpine data?)
There are no errors in console.
Form is standard one generate by livewire-forms:setup
Interestingly when I did ugly workaround by changing:
-
src/Livewire/Concerns/HandlesValidation.php:22
->filter(fn ($value, $field) => $this->submittableFields[$field] ?? true) -
src/Livewire/Concerns/HandlesValues.php:21
->filter(fn ($field) => $this->submittableFields[$field->handle] ?? true)
Everything works perfectly fine.
Environment
Application Name: Statamic
Laravel Version: 11.44.2
PHP Version: 8.3.16
Composer Version: 2.8.3
Environment: local
Debug Mode: ENABLED
URL: rapid-lp.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file
Livewire
Livewire: v3.6.2
Statamic
Addons: 2
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.50.0 PRO
Statamic Addons
aerni/livewire-forms: 9.9.1
marcorieser/statamic-livewire: 4.1.0
I can't reproduce this issue on a fresh installation. There were a couple of changes to the scripts. Try publishing them afresh with php please install. Maybe you still have the old scripts in public/vendor/livewire-forms.
Did you get it working?
Nope. I forked for now and applied ugly workaround with ??
Its a clean install too so really strange.
Do you want me to close it?
This is odd. Can you provide steps to reproduce? It works on my end but I'm probably missing something.
Would love to fix this. You say:
After some digging it looks like for some reason with my setup
dist/js/forms.jsfails to set it (or even to add to Alpine data?).
What's your setup? Anything special? Are you bundling manually by any chance? Can you provide a simple repo that reproduces the issue?
Just giving this another nudge 😉
Are you still running into this issue?
Hey @aerni Im sorry for abandoning this. I cannot replicate that on completly new install and project this issue popped up on has been stalled for some time. Im closing it.