Jump to:

5541 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » How to change the value of the TextField?

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

Page: 1
Go to End
Author Topic: 281 Views
  • jSimple
    Avatar
    Community Member
    3 Posts

    How to change the value of the TextField? Link to this post

    How to change the value of the field before displaying? Rate = Rate*10?????
    ...
    private $db = array(
    'Rate' => 'Text'
    );

    ...

    function getCMSFields(){
       $fields = parent::getCMSFields();

    $Rate = new TextField('Rate', 'Процент, %','00','2');
          $fields->addFieldToTab('Root.Main', $Rate, 'DateFormat');

  • walid
    Avatar
    Community Member
    3 Posts

    Re: How to change the value of the TextField? Link to this post

    $myValue = $this->Rate * 10;
    $Rate = new TextField('Rate', 'Процент, %', $myValue );

    cheers

  • jSimple
    Avatar
    Community Member
    3 Posts

    Re: How to change the value of the TextField? Link to this post

    Hello!
    It is work but does not.
    I need to change the value after reading from database.

    private static $db = array(
    'Rate' => 'Text' <----This value
    );

    281 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.