notwut
notwut
FFilament
Created by notwut on 8/9/2023 in #❓┊help
Set form field value from outside the form
I am dispatching the 'set-date' event from the blade of a Livewire component and want to set the value of the 'date' form field in my updateDateFormField() method. This looks something like this.
class EditModel
{
#[On('set-date')]
public function updateDateFormField($date)
{
$this->data['date'] = $date;
}

public function form(Form $form): Form
{
return $form
->schema([
DatePicker::make('date'),
...
])
->statePath('data');
}
}
class EditModel
{
#[On('set-date')]
public function updateDateFormField($date)
{
$this->data['date'] = $date;
}

public function form(Form $form): Form
{
return $form
->schema([
DatePicker::make('date'),
...
])
->statePath('data');
}
}
If I change the value with $this->data['date'] = $date, the value is changed to the date, but ->afterStateUpdated() is not executed. Is there any way I can set the value and ->afterStateUpdated() of my form field 'date' will be executed?
5 replies
FFilament
Created by notwut on 6/19/2023 in #❓┊help
Pass value to custom field
7 replies