F
Filament2mo ago
Darnes

V4 wire:click and wire:change not fire in ->extraAttributes

after upgrade V3 project to V4 wire:click and wire:change not firing in many places
protected function getCreateFormAction(): Action
{
return parent::getCreateFormAction()

->extraAttributes(['type' => 'button', 'wire:click' => 'create']);
}
protected function getCreateFormAction(): Action
{
return parent::getCreateFormAction()

->extraAttributes(['type' => 'button', 'wire:click' => 'create']);
}
->extraAttributes([
'wire:change' => "ChkItem",
'wire:keydown.enter' => "ChkItem",
])
->extraAttributes([
'wire:change' => "ChkItem",
'wire:keydown.enter' => "ChkItem",
])
here wire:keydown.enter fire , but wire:change not .
6 Replies
Dennis Koch
Dennis Koch2mo ago
Where are you using these and what are you trying to do? change events are emitted on selects and inputs. And you probably need ->extraInputAttributes()
Darnes
DarnesOP2mo ago
protected function getCreateFormAction(): Action
{
return parent::getCreateFormAction()

->extraAttributes(['type' => 'button', 'wire:click' => 'create']);
}
protected function getCreateFormAction(): Action
{
return parent::getCreateFormAction()

->extraAttributes(['type' => 'button', 'wire:click' => 'create']);
}
this function is in Resource Create Page , to prevent save when hit enter key , and save only when click save button the exact function work in V3 and this :
->extraAttributes([
'wire:change' => "ChkItem",
'wire:keydown.enter' => "ChkItem",
])
->extraAttributes([
'wire:change' => "ChkItem",
'wire:keydown.enter' => "ChkItem",
])
on Select . and also not fire with ->extraInputAttributes()
Dennis Koch
Dennis Koch2mo ago
Check the HTML. It's probably not applied not the <select> element Not sure why this code should prevent the form submission via Enter?
Darnes
DarnesOP2mo ago
In V3 prevent , it work since year ago in some of my projects . So if are there any other solution ?
Dennis Koch
Dennis Koch2mo ago
Ah, probably the change from type="submit" to type="button" did that. Probably the type is not overwritten anymore? Then I guess the only options is some Javascript
Darnes
DarnesOP2mo ago
May by Filament team add an option to create page is the best solution

Did you find this page helpful?