Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

How to change the value of the TextField?


Reply

3 Posts   292 Views

Avatar
jSimple

7 May 2014 at 5:01am Community Member, 3 Posts

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

Avatar
walid

8 May 2014 at 1:07am Community Member, 3 Posts

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

cheers

Avatar
jSimple

10 May 2014 at 7:22am Community Member, 3 Posts

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