mariusticha
mariusticha
FFilament
Created by ericmp on 11/20/2023 in #❓┊help
How to retrieve form's data inside requiresConfirmation fn?
maybe form validation or notifications can be a help in this use case
16 replies
FFilament
Created by ericmp on 11/20/2023 in #❓┊help
How to retrieve form's data inside requiresConfirmation fn?
when you confirm the modal, the result of the form is available in the ->action() method. but there is no additional confirmation required based on the form input
16 replies
FFilament
Created by ericmp on 11/20/2023 in #❓┊help
How to retrieve form's data inside requiresConfirmation fn?
it seems that you can do so, but the result is a requires confirmation modal containing the form
16 replies
FFilament
Created by ericmp on 11/20/2023 in #❓┊help
How to retrieve form's data inside requiresConfirmation fn?
so imo it is not intended to retrieve the action's form input and require an additional confirmation for this input
16 replies
FFilament
Created by ericmp on 11/20/2023 in #❓┊help
How to retrieve form's data inside requiresConfirmation fn?
if you leave the parameter of requiresConfirmation() blank you can see that it triggers a confirmation modal rendering the form
16 replies
FFilament
Created by ericmp on 11/20/2023 in #❓┊help
How to retrieve form's data inside requiresConfirmation fn?
i think the closure you can pass into requiresConfirmation() is there to evaluate if the action needs confirmation or not. it's not meant to evaluate the action's form data
16 replies
FFilament
Created by terumi on 11/16/2023 in #❓┊help
Persist toggleable column state between sessions
maybe this will help you a little
13 replies
FFilament
Created by terumi on 11/16/2023 in #❓┊help
Persist toggleable column state between sessions
alright now i understand what your looking for. i've done a little research on this and i haven't found a built in functionality for this use case. what i've found is the part in the app where the visible columns are determined. that should be this method here: https://github.com/filamentphp/filament/blob/3.x/packages/tables/src/Table/Concerns/HasColumns.php#L101
13 replies
FFilament
Created by Miguel García on 10/11/2023 in #❓┊help
Select afterStateUpdated does not fire when selection is cleared
you are completely right. in my example above the datepicker is set to ->live(), that's why it was working 🫣
25 replies
FFilament
Created by Miguel García on 10/11/2023 in #❓┊help
Select afterStateUpdated does not fire when selection is cleared
thanks. it was fun to take a deeper look into this unexpected behaviour
25 replies
FFilament
Created by Miguel García on 10/11/2023 in #❓┊help
Select afterStateUpdated does not fire when selection is cleared
imho it should be irrelevant whether the date picker is live or not
25 replies
FFilament
Created by Miguel García on 10/11/2023 in #❓┊help
Select afterStateUpdated does not fire when selection is cleared
i even get the expected results in an example where the second input is a datepicker and its value is only set to zero if the value of the select is 1:
Select::make('foo')
->live()
->native(false)
->afterStateUpdated(function (Set $set, ?string $state) {
if ($state !== '1') {
$set('bar', null);
}

logs()->debug('test', [
'state' => $state,
'foo' => $this->data['foo'],
'bar' => $this->data['bar'],
]);
})
->options([
'0' => 0,
'1' => 1,
]),
DatePicker::make('bar')
->displayFormat('d/m/Y')
->live()
->native(false)
Select::make('foo')
->live()
->native(false)
->afterStateUpdated(function (Set $set, ?string $state) {
if ($state !== '1') {
$set('bar', null);
}

logs()->debug('test', [
'state' => $state,
'foo' => $this->data['foo'],
'bar' => $this->data['bar'],
]);
})
->options([
'0' => 0,
'1' => 1,
]),
DatePicker::make('bar')
->displayFormat('d/m/Y')
->live()
->native(false)
` bringing me these logs:
[2023-11-16 22:56:09] laravel.DEBUG: test {"state":"1","foo":"1","bar":"2023-11-30 00:00:00"}
[2023-11-16 22:56:13] laravel.DEBUG: test {"state":"0","foo":"0","bar":null}
[2023-11-16 22:56:23] laravel.DEBUG: test {"state":null,"foo":null,"bar":null}
[2023-11-16 22:56:09] laravel.DEBUG: test {"state":"1","foo":"1","bar":"2023-11-30 00:00:00"}
[2023-11-16 22:56:13] laravel.DEBUG: test {"state":"0","foo":"0","bar":null}
[2023-11-16 22:56:23] laravel.DEBUG: test {"state":null,"foo":null,"bar":null}
and everything looks as expected in the browser.
25 replies
FFilament
Created by Miguel García on 10/11/2023 in #❓┊help
Select afterStateUpdated does not fire when selection is cleared
this example
Select::make('foo')
->live()
->native(false)
->afterStateUpdated(function (Set $set, ?string $state) {
$set('bar', $state);

logs()->debug('test', [
'state' => $state,
'foo' => $this->data['foo'],
'bar' => $this->data['bar'],
]);
})
->options([0, 1]),
TextInput::make('bar'),
Select::make('foo')
->live()
->native(false)
->afterStateUpdated(function (Set $set, ?string $state) {
$set('bar', $state);

logs()->debug('test', [
'state' => $state,
'foo' => $this->data['foo'],
'bar' => $this->data['bar'],
]);
})
->options([0, 1]),
TextInput::make('bar'),
brings me these results when i first select 0, then 1 and then deselect using the X:
[2023-11-16 22:44:44] laravel.DEBUG: test {"state":"0","foo":"0","bar":"0"}
[2023-11-16 22:44:46] laravel.DEBUG: test {"state":"1","foo":"1","bar":"1"}
[2023-11-16 22:44:48] laravel.DEBUG: test {"state":null,"foo":null,"bar":null}
[2023-11-16 22:44:44] laravel.DEBUG: test {"state":"0","foo":"0","bar":"0"}
[2023-11-16 22:44:46] laravel.DEBUG: test {"state":"1","foo":"1","bar":"1"}
[2023-11-16 22:44:48] laravel.DEBUG: test {"state":null,"foo":null,"bar":null}
25 replies
FFilament
Created by Miguel García on 10/11/2023 in #❓┊help
Select afterStateUpdated does not fire when selection is cleared
to check if afterStateUpdated is called correctly when you deselect an option, you can use the logs. showing that everything works exactly as expected
25 replies
FFilament
Created by Miguel García on 10/11/2023 in #❓┊help
Select afterStateUpdated does not fire when selection is cleared
i did a little research in this case and apparently the solution is slightly different. the crucial difference between your first and your second example is not that you set the second component to live (and it's also not about whether native is set to true or false, as i suggested). the problem in your first example is the dd() in afterStateUpdated. this stops the execution before the roundtrip is completely finished, leaving the app in an inconsistent state between server and client.
25 replies
FFilament
Created by mariusticha on 11/16/2023 in #❓┊help
validation ->in() rule is not executed when checking against an empty array
thanks for your explanation 🙏 will create a PR
9 replies
FFilament
Created by terumi on 11/16/2023 in #❓┊help
Persist toggleable column state between sessions
i'm not sure if i understand your problem exactly, but is maybe this what you're looking for? https://filamentphp.com/docs/3.x/tables/columns/getting-started#making-toggleable-columns-hidden-by-default
13 replies
FFilament
Created by Miguel García on 10/11/2023 in #❓┊help
Select afterStateUpdated does not fire when selection is cleared
using ->native(true) seems to fire afterStateUpdated
25 replies
FFilament
Created by Yaeger on 9/26/2023 in #❓┊help
How do you test repeaters?
this sets the content of data.answers regardless of its previous value, overriding the default(1) item indexed by the uuid
23 replies
FFilament
Created by Yaeger on 9/26/2023 in #❓┊help
How do you test repeaters?
we've found another solution, pointing into the same direction:
->set('data.answers', [
[
'text' => "test_text",
'correct' => true
],
[
'text' => "test_text2",
'correct' => false
]
])
->set('data.answers', [
[
'text' => "test_text",
'correct' => true
],
[
'text' => "test_text2",
'correct' => false
]
])
23 replies