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