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, simon_w

Validation for Editform in the backend


Reply

5 Posts   311 Views

Avatar
khanhdeux

8 December 2013 at 6:42am Community Member, 13 Posts

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

9 December 2013 at 1:38am Forum Moderator, 1091 Posts

This might help:

http://doc.silverstripe.org/framework/en/topics/form-validation#validation-in-the-cms

Martine

Avatar
khanhdeux

9 December 2013 at 1:05pm Community Member, 13 Posts

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

9 December 2013 at 11:10pm Forum Moderator, 1796 Posts

Please see the below thread...

http://www.silverstripe.org/general-questions/show/17007

Avatar
khanhdeux

10 December 2013 at 7:55am Community Member, 13 Posts

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