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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Validation for Editform in the backend


Go to End


5 Posts   1089 Views

Avatar
khanhdeux

Community Member, 13 Posts

8 December 2013 at 6:42am

Hi team,
Do you know how to add validation to backend, i tried with getEditFrom in ModelAdmin and evene getCMSAction of class DataObject but no success. Thanks

Avatar
martimiz

Forum Moderator, 1391 Posts

9 December 2013 at 1:38am

Avatar
khanhdeux

Community Member, 13 Posts

9 December 2013 at 1:05pm

Thanks for your help . I am a newbie in silvertripe so it would be nice if you can answer further like i had already the video module
class VideoAdmin extends ModelAdmin {

private static $managed_models = array('Video');
private static $url_segment = 'video';
private static $menu_title = 'Video';

}

HOw can i add getCMSValidator to validate the video title based on the following DataObject

class Video extends DataObject {

private static $db = array(
'VideoTitle' => 'Varchar(255)',
'VideoDescription' => 'Text',
'OwnerID' => 'Int'
);
}

Avatar
swaiba

Forum Moderator, 1899 Posts

9 December 2013 at 11:10pm

Avatar
khanhdeux

Community Member, 13 Posts

10 December 2013 at 7:55am

Fantastic, you are my life saver. Thank you very much