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.

Data Model Questions /

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

how to connect two values from $fields in CMS to one value ?


Go to End


1743 Views

Avatar
snaip

Community Member, 181 Posts

14 May 2009 at 9:35pm

Edited: 14/05/2009 9:35pm

hi

i have two dropdownfields

   static $db = array(
      'calendar_month' => "Enum('01,02,03,04,05,06,07,08,09,10,11,12','01')",
      'calendar_year => "Enum('2009,2010,2011','2009')"
      'calendar' => 'text'
   );
   
   static $has_one = array(  
   );

   function getCMSFields() {
      $fields = parent::getCMSFields();
      $fields->addFieldToTab("Root.Content.Main", new DropdownField('calendar_month','Select month',singleton('PlOpiniePage')->dbObject('calendar_month')->enumValues()),Content);
      $fields->addFieldToTab("Root.Content.Main", new DropdownField('calendar_year','Select year',singleton('PlOpiniePage')->dbObject('calendar_year')->enumValues()),Content);
      return $fields;
   } 

how to connect these two values to one and put it into 'calendar' field ?

01 + 2009 = 012009