F
Filamentβ€’7mo ago
leoblanski

ColorPicker Required Bug

Guys, I'm trying to use a color picker inside a Custom Livewire Page, using a form from Filament, and for some reason, the ColorPicker is not working as expected. All other fields are working like a charm, but specifically, the Color Picker is always required, even with a filled value.
Forms\Components\ColorPicker::make('primary_color')
->label('Cor')
->required()
Forms\Components\ColorPicker::make('primary_color')
->label('Cor')
->required()
When I remove 'required' and debug the sent form, primary_color is received as null. If I keep required, form is not sended because requires value. I'm using inside custom page like: {{ $this->form }} I use the same with a lot other pages (without color picker) and it works. I tried to upgrade all my packages but continue.
No description
Solution:
I follow the doc, but I forgot to set the form fill on Mount $this->form->fill();...
Jump to solution
16 Replies
Tally
Tallyβ€’7mo ago
Do you get this error when editing? or also when creating a record?
leoblanski
leoblanskiOPβ€’7mo ago
Sorry by the late guys. Creating and editing. Yep @Leandro Ferreira , If I remove color picker everything works fine, and if I change the colorPicker to a TextInput it works too. It seems like the Color Picker is not updating the value into "model" Because if I put the same value, ex #ffffff inside a TextInput and try to send the form, I receive the value correctly.
LeandroFerreira
LeandroFerreiraβ€’7mo ago
Does it show the value?
$data = $this->form->getState();
dd($data);
$data = $this->form->getState();
dd($data);
leoblanski
leoblanskiOPβ€’7mo ago
No, It doesn't Leandro... If I change to TextInput it does, but as ColorPicker doesn't.
LeandroFerreira
LeandroFerreiraβ€’7mo ago
Are you using the panel builder with a custom page or only the form builder? console errors?
leoblanski
leoblanskiOPβ€’7mo ago
No console erros 😦 I'm with a custom page... I'm creating the page again reviewing everything Following the doc again
LeandroFerreira
LeandroFerreiraβ€’7mo ago
custom page in the panel builder?
leoblanski
leoblanskiOPβ€’7mo ago
Maybe I forget something, the weird is that with TextInput it works, and ColorPicker it doesn't Yep @Leandro Ferreira, It's inside a Panel, I'm trying to create a "Confirm Signup" page after register Ops, actually I define this route directly on my web.php. Route::get('confirm-signup', ConfirmSignup::class)->name('auth.confirm-signup');
LeandroFerreira
LeandroFerreiraβ€’7mo ago
are you using a simple page? I mean, as login, register..
leoblanski
leoblanskiOPβ€’7mo ago
My ConfirmSignup I extend from Filament\Pages\Page And login, is the same from filament, just change the layout
LeandroFerreira
LeandroFerreiraβ€’7mo ago
filament version?
leoblanski
leoblanskiOPβ€’7mo ago
"filament/filament": "^3.2.83", Guy, I found the problem My fault...
Solution
leoblanski
leoblanskiβ€’7mo ago
I follow the doc, but I forgot to set the form fill on Mount $this->form->fill();
leoblanski
leoblanskiOPβ€’7mo ago
I focused on TextInput working and keep my eyes out from the obvious. Thanks for your help @Leandro Ferreira
LeandroFerreira
LeandroFerreiraβ€’7mo ago
That's why I asked if you had followed this section of the docs πŸ€·β€β™‚οΈ
Want results from more Discord servers?
Add your server