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.

General Questions /

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

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

Validation for Editform in the backend


Go to End
Reply


5 Posts   472 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, 1199 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, 1824 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