File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
code/Model/EditableFormField Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change 22
33namespace SilverStripe \UserForms \Model \EditableFormField ;
44
5+ use SilverStripe \Core \ClassInfo ;
56use SilverStripe \Forms \DropdownField ;
67use SilverStripe \Forms \FieldGroup ;
78use SilverStripe \Forms \FieldList ;
@@ -185,7 +186,7 @@ protected function updateFormField($field)
185186 }
186187
187188 if (is_numeric ($ this ->MaxLength ) && $ this ->MaxLength > 0 ) {
188- if ($ field instanceof TextField ) {
189+ if (ClassInfo:: hasMethod ( $ field, ' setMaxLength ' ) ) {
189190 $ field ->setMaxLength ((int ) $ this ->MaxLength );
190191 }
191192 $ 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()
232232 // textarea
233233 $ textField ->Rows = 3 ;
234234 $ attributes = $ textField ->getFormField ()->getAttributes ();
235- $ this ->assertFalse ( isset ( $ attributes ['maxLength ' ]) );
235+ $ this ->assertEquals ( 20 , $ attributes ['maxlength ' ] );
236236 $ this ->assertEquals (10 , $ attributes ['data-rule-minlength ' ]);
237237 $ this ->assertEquals (20 , $ attributes ['data-rule-maxlength ' ]);
238238 }
You can’t perform that action at this time.
0 commit comments