Set focus on a form field after action #15459
Answered
by
leandrocfe
MagicDidou
asked this question in
Help
Replies: 1 comment 2 replies
-
TextInput::make('designation')
->id('designation')
... use Filament\Pages\Page;
..
Actions\Action::make('Ajouter')
->action(function () { ... })
->after(function (Page $livewire) {
$livewire->js('document.getElementById(\'designation\').focus()');
}) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
MagicDidou
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Package
Form builder
Package Version
v3.2
How can we help you?
Hi all,
I'm working on a project since couple months now and I'm solving some ergonomics and aesthetic points. I have a page handling a
Form
which is used to populate aTable
displayed below the form (without redrawing the page because it makes user loosing too much time).To do that I have an
Action
button which creates a record in the DB and then clears fields for a new entry. But I would like the focus being on the first field of theForm
after record save operation. The->autofocus()
only works for the page creation.Here is the code :
Any idea how to do that ?
Did
Beta Was this translation helpful? Give feedback.
All reactions