afterstateupdated not working inside custom page and have a plain submit button
this is my code custom page
class PenagihanPiutang extends Page implements HasForms, HasTable
{
use InteractsWithTable, InteractsWithForms;
protected static ?string $model = Piutang::class;
protected ?string $subheading = 'Pembuatan Tagihan Piutangan';
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static string $view = 'filament.pages.penagihan-piutang';
protected static ?string $cluster = PiutangCluster::class;
protected $rules = [
'customer_id' => 'required'
];
public ?array $data = [];
public function mount(): void
{
$this->form->fill();
}
public function form(Form $form): Form
{
return $form
->schema([
Section::make('')
->schema([
Select::make('customer_id')
->label('Customer')
->options(
function () {
return Customer::all()->pluck('nama', 'id');
}
)
->live()
->afterStateUpdated(function ($state) {
dd($state);
}),
15 Replies
did you add the
->statePath('data')
in the form?no
inside field form?
hahah ok thx u bro
i accident delete statePath
However, if you don't want to use statePath, declare the customer_id
public $customer_id;
ok thx u nice info
what about a plain submit button bro
i try blade component cant submit
ya i used this but no run form submit
form not submited bro
<form wire:submit="create">
{{ $this->form }}
<x-filament::button> Submit </x-filament::button>
</form>
<x-filament::button> Submit </x-filament::button>
</form>
Check your netowrk logs, do you see any interaction?
You need to specify the button as
type=“submit”
.Top Spot!
nica thx u all