File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
javascript/controllers/forms Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ export default class extends Controller {
10
10
type : Number ,
11
11
default : 0 ,
12
12
} ,
13
+ mininumLength : {
14
+ type : Number ,
15
+ default : 0 ,
16
+ } ,
13
17
} ;
14
18
15
19
connect ( ) {
@@ -28,10 +32,14 @@ export default class extends Controller {
28
32
return ;
29
33
}
30
34
31
- if ( event . target . value . length >= 3 ) {
35
+ if ( event . target . value . length >= this . mininumLengthValue ) {
32
36
this . element . requestSubmit ( ) ;
33
37
} else {
34
- console . log ( 'Not submitting until 3 or more characters' ) ;
38
+ console . log (
39
+ 'Not submitting until' ,
40
+ this . mininumLengthValue ,
41
+ 'characters' ,
42
+ ) ;
35
43
}
36
44
}
37
45
}
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ def view_template
27
27
data : {
28
28
controller : "autosubmit-form" ,
29
29
autosubmit_delay_value : 300 ,
30
+ autosubmit_minimum_length_value : 3 ,
30
31
turbo_frame : :search
31
32
} do |f |
32
33
div ( class : "flex items-center flex-row pl-2 col-gap-xs" ) do
You can’t perform that action at this time.
0 commit comments