TextBase: set maxlength to the lowest allowed value

This fixes a similar issue as #1335. Maxlength attribute should be set to the lowest allowed value.