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
Patrick2mo 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 Nepali2mo ago
Here if user is logged in then User input should be hide but userId should be sent.
No description
Lara Zeus
Lara Zeus2mo 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
Sydd2mo ago
Or hidden input?
Dennis Koch
Dennis Koch2mo ago
You should use the mutateDataBeforeSave method.