File tree 1 file changed +10
-1
lines changed
apps/www/src/routes/examples/forms
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 25
25
import { zodClient } from " sveltekit-superforms/adapters" ;
26
26
import { cn } from " $lib/utils" ;
27
27
import { browser } from " $app/environment" ;
28
+ import { tick } from " svelte" ;
28
29
29
30
export let data: SuperValidated <Infer <ProfileFormSchema >>;
30
31
36
37
37
38
function addUrl() {
38
39
$formData .urls = [... $formData .urls , " " ];
40
+
41
+ tick ().then (() => {
42
+ const urlInputs = Array .from (
43
+ document .querySelectorAll <HTMLElement >(" #profile-form input[name='urls']" )
44
+ );
45
+ const lastInput = urlInputs [urlInputs .length - 1 ];
46
+ lastInput && lastInput .focus ();
47
+ });
39
48
}
40
49
41
50
$ : selectedEmail = {
44
53
};
45
54
</script >
46
55
47
- <form method =" POST" class =" space-y-8" use:enhance >
56
+ <form method =" POST" class =" space-y-8" use:enhance id = " profile-form " >
48
57
<Form .Field {form } name =" username" >
49
58
<Form .Control let:attrs >
50
59
<Form .Label >Username</Form .Label >
You can’t perform that action at this time.
0 commit comments