Jump to:

2002 Posts in 1422 Topics by 616 members

Form Questions

SilverStripe Forums » Form Questions » Forms for $many_many_extraFields problem

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

Page: 1
Go to End
Author Topic: 155 Views
  • khanhdeux
    Avatar
    Community Member
    13 Posts

    Forms for $many_many_extraFields problem Link to this post

    Hi i have a problem regarding form
    i have 2 Dataobjects
    class Channel extends DataObject {

    private static $db = array(
    'ChannelTitle' => 'Varchar(255)',
    'ChannelDescription' => 'Text',
    'ChannelUser' => 'Varchar(255)',
    'ChannelPassword' => 'Varchar(255)'
    );
    private static $many_many = array(
    'Videos' => 'Video'
    );
    private static $has_one = array(
    'Member' => 'Member',
    );
    private static $summary_fields = array(
    'ChannelTitle'
    );
    private static $many_many_extraFields = array(
    'Videos' => array(
    'PublishedDate' => 'SS_Datetime',
    'UnpublishedDate' => 'SS_Datetime',
    'Status' => 'Boolean'
    )
    );

    class Video extends DataObject {
    private static $belongs_many_many = array(
    'VideoCategories' => 'VideoCategory',
    'Channels' => 'Channel',
    );

    In the form i used
    $ChannelList = Channel::getByMember()->map('ID', 'ChannelTitle');
    $fields = new FieldList(
    new TextField('VideoTitle', 'Video title'),
    new TextField('VideoDescription', 'Video description'),
    $VideoFile = new BootstrapUploadField('VideoFile', 'Upload Video File'),
    new CheckboxSetField('Channels', 'Choose channels', $ChannelList)
    );
    $this->loadDataFrom(singleton('Video'));

    Its working properly but i dont know how to pop up and show the publishedDate and unpublishedDate for each channel. Any solution is really appreciated. Thanks

    155 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.