Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Limiting characters in backend fields

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1339 Views
  • Teng
    Avatar
    Community Member
    11 Posts

    Limiting characters in backend fields Link to this post

    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?

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Limiting characters in backend fields Link to this post

    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');

    1339 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.