[Solved]ToggleButtons
hi everyone, i m trying to use Togglebuttons in my form but a msg : " filament-forms::components.toggle_buttons.boolean.true " is displayed instead of buttons
Solution:Jump to solution
thank u, i fix it with publishing translation and add toggle_buttons entry to the lang\vendor\filament-forms\fr\components.php
33 Replies
Please share code, otherwise it is impossible to help
Forms\Components\ToggleButtons::make('courrier_interne')
->label('Courrier interne ?')
->boolean()
->required()
->validationMessages([
'required' => 'Vous devez choisir une option',
]),
Is it inside the panel or on a standalone form?
can u share the relevant code arround it? If its in a standalone form, how does the blade file look like
inside the panel
I just copy+pasted your code into one of my resources and it shows up
And even the required check is working
😅
i wish view it in my page
lets just try:
i try it but still given same error
then try
THis will delete the composer vendor folder and refetch all of it
maybe something in the vendor folder is fucked up
or even better
composer update
to gat latest filamentsame issu
i ll try with comoser update
unluckily, still given same msg
hmm. sry, then without code access, I am at my wit's end.
Thank you very much. I am grateful for your cooperation👍
in my comoser.json i have in my filament version 3.1, is it the source of my problem ?
"require": {
"php": "^8.1",
"barryvdh/laravel-dompdf": "^2.0",
"bezhansalleh/filament-language-switch": "^3.0",
"filament/filament": "^3.1",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.3",
"laravel/tinker": "^2.8"
},
Puh. idk. I have "filament/filament": "^3.0-stable", which resolves to 3.2.1 atm
Whats ur current version:
Sorry for making this topic so long
na, u are on latest as well
no problem, if I dont wanna help, I would just stop answering 😉
As I said, its hard without the full code. Can u show me the resource class + the EditRecord class?
and u can try deleting the bootstrap/cache folder as well, maybe is something inside there, which causes the issus
e
the class :
Edit
Strange, I tried the example in the toggleButtons Tuto and thats work !!
Forms\Components\ToggleButtons::make('status')
->options([
'draft' => 'Draft',
'scheduled' => 'Scheduled',
'published' => 'Published'
]),
with options works but if boolean() it fails🙄
for me its working with boolean as well
as I already said
just as an experiment: try to go on the create site
does it work there?
I mean, not editing an existing record, but on the create page
maybe it is a weird casting problem or so
it dosnt work any where
that looks like a translation string error
U r right
can u suggest a solution plz
is that French?
looks like it may be missing from the translation file
you could PR the translation
this is the EN file https://github.com/filamentphp/filament/blob/fda8417925366209bacad9844278f1d28c00c703/packages/forms/resources/lang/en/components.php#L438
GitHub
filament/packages/forms/resources/lang/en/components.php at fda8417...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
I don't see a corresponding entry in the FR file packages/forms/resources/lang/fr/components.php
Solution
thank u, i fix it with publishing translation and add toggle_buttons entry to the lang\vendor\filament-forms\fr\components.php
👍 I'd PR it myself but I'm about to go out for a dinner and a movie
i would thank @bernhard for consuming its time for dinner😅