Hello, I'm trying to work out how to show on a single form multiple instances on the same form, so...
class ObjOne extends DataObject{
static $db = array('ItemOne'=>'Text');
}
class ObjTwo extends DataObject{
static $db = array('ItemTwo'=>'Text');
}
...
//I'd like to do the following to create the fields...
$fields = new FieldSet();
for($i=0;$i<5;$i++)
$fields->merge(singleton('ObjOne')->getFrontendFields());
for($i=0;$i<10;$i++)
$fields->merge(singleton('ObjTwo')->getFrontendFields());
...
//then do something like this in the form action to save them... (where $data is the data passed from the form)
for($i=0;$i<5;$i++){
$doObjOne= new ObjOne($data);
$doObjOne->write();
}
for($i=0;$i<10;$i++){
$doObjTwo= new ObjOne($data);
$doObjTwo->write();
}
Can someone help with a way of doing this without having to go "long hand" and specify everything field and then set each field at the end manually?
Barry