[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:
thank u, i fix it with publishing translation and add toggle_buttons entry to the lang\vendor\filament-forms\fr\components.php
Jump to solution
33 Replies
bernhard
bernhard5mo ago
Please share code, otherwise it is impossible to help
MajistraFila
MajistraFila5mo ago
Forms\Components\ToggleButtons::make('courrier_interne') ->label('Courrier interne ?') ->boolean() ->required() ->validationMessages([ 'required' => 'Vous devez choisir une option', ]),
bernhard
bernhard5mo ago
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
MajistraFila
MajistraFila5mo ago
inside the panel
bernhard
bernhard5mo ago
I just copy+pasted your code into one of my resources and it shows up
No description
MajistraFila
MajistraFila5mo ago
No description
bernhard
bernhard5mo ago
And even the required check is working
No description
MajistraFila
MajistraFila5mo ago
😅 i wish view it in my page
bernhard
bernhard5mo ago
lets just try:
composer dump-autoload
php artisan optimize:clear
npm run dev
composer dump-autoload
php artisan optimize:clear
npm run dev
MajistraFila
MajistraFila5mo ago
i try it but still given same error
bernhard
bernhard5mo ago
then try
rm -rf vendor
composer install
rm -rf vendor
composer install
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 updateto gat latest filament
MajistraFila
MajistraFila5mo ago
same issu i ll try with comoser update unluckily, still given same msg
bernhard
bernhard5mo ago
hmm. sry, then without code access, I am at my wit's end.
MajistraFila
MajistraFila5mo ago
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" },
bernhard
bernhard5mo ago
Puh. idk. I have "filament/filament": "^3.0-stable", which resolves to 3.2.1 atm Whats ur current version:
composer show filament/filament
name : filament/filament
descrip. : A collection of full-stack components for accelerated Laravel app development.
keywords :
versions : * v3.2.21
composer show filament/filament
name : filament/filament
descrip. : A collection of full-stack components for accelerated Laravel app development.
keywords :
versions : * v3.2.21
MajistraFila
MajistraFila5mo ago
No description
MajistraFila
MajistraFila5mo ago
Sorry for making this topic so long
bernhard
bernhard5mo ago
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
MajistraFila
MajistraFila5mo ago
the class :
MajistraFila
MajistraFila5mo ago
Edit
MajistraFila
MajistraFila5mo ago
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🙄
bernhard
bernhard5mo ago
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
MajistraFila
MajistraFila5mo ago
it dosnt work any where
Blackpig
Blackpig5mo ago
that looks like a translation string error
MajistraFila
MajistraFila5mo ago
U r right can u suggest a solution plz
Blackpig
Blackpig5mo ago
is that French? looks like it may be missing from the translation file you could PR the translation
Blackpig
Blackpig5mo ago
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
Blackpig
Blackpig5mo ago
I don't see a corresponding entry in the FR file packages/forms/resources/lang/fr/components.php
Solution
MajistraFila
MajistraFila5mo ago
thank u, i fix it with publishing translation and add toggle_buttons entry to the lang\vendor\filament-forms\fr\components.php
Blackpig
Blackpig5mo ago
👍 I'd PR it myself but I'm about to go out for a dinner and a movie
MajistraFila
MajistraFila5mo ago
i would thank @bernhard for consuming its time for dinner😅