21489 Posts in 5783 Topics by 2621 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 774 Views |
-
PopulateDefault a DataObjectManager List

14 March 2010 at 12:13pm
Hi,
My client has a need to be able to build a DataObjectManager list of default values.
I thought I was going to be able to use something like;
public static $db = array(
'TextBox1' => 'Text',
'TextBox2' => 'Text',
'TextBox3' => 'Text'
);
public static $has_many = array(
'ProjectFields1' => 'ProjectField'
);
public function populateDefaults() {
$this->TextBox1 = 'Eggs Are Great';
$this->TextBox2 = 'Patty is a winner';
$this->TextBox3 = 'Maya steps very loudly';
$this->ProjectFields1 = array(
array(
'Title'=>'Question 01',
'Description'=>'Lorem ipsum dolor sit amet, consectetur adipisicing elit.'
),
array(
'Title'=>'Question 02',
'Description'=>'Lorem ipsum dolor sit amet, consectetur adipisicing elit.'
)
);
parent::populateDefaults();
}but no luck
The DataObject I'm using looks like
class ProjectField extends DataObject {
static $db = array(
'Title' => 'Text',
'Description' => 'HTMLText',
);static $has_one = array(
'ProjectField' => 'GeneralPage',
);function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push( new TextField( 'Title' ) );
$fields->push( new SimpleWysiwygField('Description'));
return $fields;
}
}Two questions I suppose, am I heading in the right direction? if so could possibly help me over the edge?
Second, is it all possible? I would of thought so.
Any help would be greatly appreciated.
| 774 Views | ||
|
Page:
1
|
Go to Top |

