File tree 2 files changed +3
-2
lines changed
code/Model/EditableFormField
2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace SilverStripe \UserForms \Model \EditableFormField ;
4
4
5
+ use SilverStripe \Core \ClassInfo ;
5
6
use SilverStripe \Forms \DropdownField ;
6
7
use SilverStripe \Forms \FieldGroup ;
7
8
use SilverStripe \Forms \FieldList ;
@@ -185,7 +186,7 @@ protected function updateFormField($field)
185
186
}
186
187
187
188
if (is_numeric ($ this ->MaxLength ) && $ this ->MaxLength > 0 ) {
188
- if ($ field instanceof TextField ) {
189
+ if (ClassInfo:: hasMethod ( $ field, ' setMaxLength ' ) ) {
189
190
$ field ->setMaxLength ((int ) $ this ->MaxLength );
190
191
}
191
192
$ field ->setAttribute ('data-rule-maxlength ' , (int ) $ this ->MaxLength );
Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ public function testLengthRange()
232
232
// textarea
233
233
$ textField ->Rows = 3 ;
234
234
$ attributes = $ textField ->getFormField ()->getAttributes ();
235
- $ this ->assertFalse ( isset ( $ attributes ['maxLength ' ]) );
235
+ $ this ->assertEquals ( 20 , $ attributes ['maxlength ' ] );
236
236
$ this ->assertEquals (10 , $ attributes ['data-rule-minlength ' ]);
237
237
$ this ->assertEquals (20 , $ attributes ['data-rule-maxlength ' ]);
238
238
}
You can’t perform that action at this time.
0 commit comments