Is it possible to make select input invisible but send the default value with the form submit ?

Is it possible to make select input invisible but send the default value with the form data on submit ?
5 Replies
Patrick
Patrick8mo ago
Hi, do you have an example what you try to do? Why do u want to use a Select instead of Hidden or other Field with visible() and dehydrated() ?
Asmit Nepali
Asmit NepaliOP7mo ago
Here if user is logged in then User input should be hide but userId should be sent.
No description
Lara Zeus
Lara Zeus7mo ago
better to make it disabled and set the value before saving depend if you're on a page or a resource or use dehydrateStateUsing
->disabled(fn(): bool => auth()->check())
->dehydrateStateUsing(fn (string $state): int => auth()->user()->id)
->disabled(fn(): bool => auth()->check())
->dehydrateStateUsing(fn (string $state): int => auth()->user()->id)
Sydd
Sydd7mo ago
Or hidden input?
Dennis Koch
Dennis Koch7mo ago
You should use the mutateDataBeforeSave method.
Want results from more Discord servers?
Add your server