[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
bernhard10mo ago
Please share code, otherwise it is impossible to help
MajistraFila
MajistraFilaOP10mo ago
Forms\Components\ToggleButtons::make('courrier_interne') ->label('Courrier interne ?') ->boolean() ->required() ->validationMessages([ 'required' => 'Vous devez choisir une option', ]),
bernhard
bernhard10mo 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
MajistraFilaOP10mo ago
inside the panel
bernhard
bernhard10mo ago
I just copy+pasted your code into one of my resources and it shows up
No description
MajistraFila
MajistraFilaOP10mo ago
No description
bernhard
bernhard10mo ago
And even the required check is working
No description
MajistraFila
MajistraFilaOP10mo ago
😅 i wish view it in my page
bernhard
bernhard10mo 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
MajistraFilaOP10mo ago
i try it but still given same error
bernhard
bernhard10mo 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
MajistraFilaOP10mo ago
same issu i ll try with comoser update unluckily, still given same msg
bernhard
bernhard10mo ago
hmm. sry, then without code access, I am at my wit's end.
MajistraFila
MajistraFilaOP10mo 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
bernhard10mo 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
MajistraFilaOP10mo ago
No description
MajistraFila
MajistraFilaOP10mo ago
Sorry for making this topic so long
bernhard
bernhard10mo 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
MajistraFilaOP10mo ago
the class :
MajistraFila
MajistraFilaOP10mo ago
Edit
MajistraFila
MajistraFilaOP10mo 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
bernhard10mo 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
MajistraFilaOP10mo ago
it dosnt work any where
Blackpig
Blackpig10mo ago
that looks like a translation string error
MajistraFila
MajistraFilaOP10mo ago
U r right can u suggest a solution plz
Blackpig
Blackpig10mo ago
is that French? looks like it may be missing from the translation file you could PR the translation
Blackpig
Blackpig10mo 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
Blackpig10mo ago
I don't see a corresponding entry in the FR file packages/forms/resources/lang/fr/components.php
Solution
MajistraFila
MajistraFila10mo ago
thank u, i fix it with publishing translation and add toggle_buttons entry to the lang\vendor\filament-forms\fr\components.php
Blackpig
Blackpig10mo ago
👍 I'd PR it myself but I'm about to go out for a dinner and a movie
MajistraFila
MajistraFilaOP10mo ago
i would thank @bernhard for consuming its time for dinner😅
Want results from more Discord servers?
Add your server