Hey i'm trying to limit the amount of characters a user can enter into certain fields of the CMS. At the moment I'm trying
$fields->addFieldToTab('Root.Content.Main', new TextField('ProjectTitle1'), 'Content', '', 20); but it doesn't seem to limit anything. Any suggestions? Should I be using $limit = 20 instead?
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
I think you need to limit in the constructor of the TextField rather then the add to tab function, so you would have
$fields->addFieldToTab('Root.Content.Main', new TextField('ProjectTitle1', 'ProjectTitle1', '', 20), 'Content');