Hidden fields are not working in repeater and builder
Package
filament/filament
Package Version
v4.1.10
Laravel Version
v12.36.1
Livewire Version
v3.6.4
PHP Version
PHP 8.4.12
Problem description
The hidden fields in repeater and builder do not save their value to database, and an empty div is displayed in the html of the page.
Expected behavior
The values of the hidden fields should be saved as usual.
Steps to reproduce
- Create a repeater with a hidden field.
- Add the item to repeat.
- Save and check the database.
The values from the hidden field will not be in the database.
Reproduction repository (issue will be closed if this is not valid)
https://github.com/indigoram89/filament-repeater-hidden-field
Relevant log output
@indigoram89 Based on a Discord message from a Filament core team member:
->hidden() removes the field completely from the form. Whereas a Hidden::make() will create a hidden input. But seeing as this has to do with cost it is best to handle this as Leandro suggested on the backend. Hidden inputs can be manipulated on the front end.
This message is 2 years old but I check and ->hidden() indeed disables the rendering of the DOM element while the Hidden component simply renders and hides the field. Strange though how this is not mentioned in the documentation (or at least I can't find anything about it).
@balintcodes thank you so much! it is so and I also found Hidden field later.