Textarea maxlength

I want to restrict the maxlength of a textarea field. The following snippet from another blog post does not seem to work for me. Any ideas?

array (
‘name’ => ‘comments_c’,
‘label’ => ‘LBL_COMMENTS’,
‘displayParams’=>array(‘rows’=>20, ‘cols’=>80, ‘maxlength’=>350),

Still allows one to enter more than the maxlength number of characters.

I noticed that this functionality was missing from SugarFields (include/SugarFields/Fields/Text). I add the following line to EditView.tpl under that folder
{{if isset($displayParams.maxlength)}}maxlength=’{{$displayParams.maxlength}}’{{elseif isset($vardef.len)}}maxlength=’{{$vardef.len}}’{{/if}}

Did a quick repair and viola. That works now.

I am planning to submit this to the source code as well since this change is not upgrade safe.


1 Like