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
LeandroFerreira
LeandroFerreira10mo ago
did you add the ->statePath('data') in the form?
jepewsykes
jepewsykesOP10mo ago
no inside field form?
LeandroFerreira
LeandroFerreira10mo ago
return $form
...
->statePath('data')
return $form
...
->statePath('data')
jepewsykes
jepewsykesOP10mo ago
hahah ok thx u bro i accident delete statePath
LeandroFerreira
LeandroFerreira10mo ago
However, if you don't want to use statePath, declare the customer_id public $customer_id;
jepewsykes
jepewsykesOP10mo ago
ok thx u nice info what about a plain submit button bro i try blade component cant submit
jepewsykes
jepewsykesOP10mo ago
No description
jepewsykes
jepewsykesOP10mo ago
ya i used this but no run form submit
jepewsykes
jepewsykesOP10mo ago
form not submited bro
jepewsykes
jepewsykesOP10mo ago
<form wire:submit="create"> {{ $this->form }}
<x-filament::button> Submit </x-filament::button>
</form>
toeknee
toeknee10mo ago
Check your netowrk logs, do you see any interaction?
awcodes
awcodes10mo ago
You need to specify the button as type=“submit”.
toeknee
toeknee10mo ago
Top Spot!
jepewsykes
jepewsykesOP10mo ago
nica thx u all
Want results from more Discord servers?
Add your server