Bob.Tern
Posts: 11
Joined: Wed Nov 15, 2023 7:02 am

Set focus into input component

how can I activate Input immediately after loading the form.
Unfortunately, Autofocus didn't help. I also need to activate the second Input if Enter is pressed in the first (KeyEnter Event)
aantsypau
Posts: 26
Joined: Wed May 24, 2023 7:57 am

Re: Set focus into input component

I made a small example to show how it works, a backup example is attached.
In a nutshell, you need to add ViewChield inclusion to the page
for input, add an attribute that starts with a hash
create a variable with the same name @ViewChild("focusinput") focusinput and type any
and to set focus call the code
this.focusinput.setFocus();
And to track the input click, you just need to add an event (keyup.enter) and specify the name of the function to call and set the focus for the second input there
I did this on the code page, but you can do it using the event panel
Attachments
app3.zip
(104.71 KiB) Downloaded 243 times
unnamed (10).png
unnamed (10).png (50.1 KiB) Viewed 13805 times
unnamed (11).png
unnamed (11).png (69.81 KiB) Viewed 13805 times
unnamed (12).png
unnamed (12).png (38.47 KiB) Viewed 13805 times
unnamed (13).png
unnamed (13).png (44.99 KiB) Viewed 13805 times
unnamed (14).png
unnamed (14).png (67.12 KiB) Viewed 13805 times
unnamed (15).png
unnamed (15).png (122.82 KiB) Viewed 13805 times
app3.zip
(104.71 KiB) Downloaded 242 times

Return to “Issues”