Zeldroxe
Zeldroxe
FFilament
Created by Zeldroxe on 4/30/2024 in #❓┊help
Custom page with InteractsWithForms trait - select field issue
Hello, I'm having an issue on my custom page where I've added the "InteractsWithForms" trait to incorporate a form. I've created the form(Form $form) function that returns a form (in my case, a special filter for my page). In this form, I have "DatePicker," "Select," "TextInput," and "ToggleButtons" fields. I have an applyFilter function that allows me to filter my data. The problem is that I can retrieve the values from each field except for those from the "Select" fields. Moreover, if I set the fields to required, the select fields generate an error during the form validation as if the selected value was not taken into account. Where could the problem be coming from? Here is the simplified code :
public ?array $customFilters = [];

public function form(Form $form): Form
{
return $form
->schema([
Select::make('sondage_id')
->label('Groupe sélectionné')
->options([
1 => "Participants",
2 => "Formateurs"
]),
])
->statePath('customFilters');
}

public function applyFilter(): void
{
dd($this->form->getState());
}
public ?array $customFilters = [];

public function form(Form $form): Form
{
return $form
->schema([
Select::make('sondage_id')
->label('Groupe sélectionné')
->options([
1 => "Participants",
2 => "Formateurs"
]),
])
->statePath('customFilters');
}

public function applyFilter(): void
{
dd($this->form->getState());
}
The html :
<form wire:submit="applyFilter" class="mb-5 p-4">
<h5 class="mb-3 mb-2 font-bold">Filtres</h5>

{{ $this->form }}

<button type="submit">
Submit
</button>

</form>
<x-filament-actions::modals />
<form wire:submit="applyFilter" class="mb-5 p-4">
<h5 class="mb-3 mb-2 font-bold">Filtres</h5>

{{ $this->form }}

<button type="submit">
Submit
</button>

</form>
<x-filament-actions::modals />
And the dd() with a selected value in the select field :
array:1 [// app\Filament\Pages\StatisticsPage.php:120
"sondage_id" => null
]
array:1 [// app\Filament\Pages\StatisticsPage.php:120
"sondage_id" => null
]
4 replies
FFilament
Created by Zeldroxe on 4/18/2023 in #❓┊help
Livewire - Don't understand how it works
6 replies
FFilament
Created by Zeldroxe on 4/17/2023 in #❓┊help
handleRecordUpdate doesn't work in ManageRecords
Hello, I would like to execute a function when saving a resource of type "Manage" but the "handleRecordUpdate" function does not work. Just like the "handleRecordCreation" function. What can I do?
6 replies
FFilament
Created by Zeldroxe on 3/15/2023 in #❓┊help
How to change repeater design ?
11 replies
FFilament
Created by Zeldroxe on 3/8/2023 in #❓┊help
[spatie-translatable] LocaleSwitcher doesn't work on CreateRecord page
Hello, I tried to use the spatie-translatable plugin and it works but not on the resource creation page. I added "Actions\LocaleSwitcher::make()", the selector is visible but it doesn't do anything when I change the language. I specify that on the other pages, everything works. Is it a bug or did I do something wrong?
5 replies
FFilament
Created by Zeldroxe on 3/6/2023 in #❓┊help
How to generate fields dynamically?
Hello, I would like to make a form in which fields are generated according to a value selected in a Select. I would like to be able to select the activity in a drop down list, then the list of packages (name of the package + textinput with the number) is displayed. How can I do this? I would like a very clean display, so I would like if possible not to have to use a repeater but rather something like a foreach loop (but I don't know how to get the data from the current record in the form() function)
13 replies
FFilament
Created by Zeldroxe on 3/3/2023 in #❓┊help
Custom value for field (fill and save field with custom table column)
Hello, I would like to make a form in which there would be 2 fields: 1 date field (day, month, year) and 1 time field (hour, minute). I would like to have these 2 data stored in a single datetime field in my table. How can I use "virtual values" for some fields? I also need these fields to retrieve these values by decomposing the datetime.
7 replies