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

Customising the CMS /

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

How to change the value of the TextField?


Go to End


3 Posts   1201 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
);