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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

How to change the value of the TextField?


Go to End


3 Posts   740 Views

Avatar
jSimple

Community Member, 3 Posts

7 May 2014 at 5:01am

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

Community Member, 3 Posts

8 May 2014 at 1:07am

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

cheers

Avatar
jSimple

Community Member, 3 Posts

10 May 2014 at 7:22am

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