7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » get values from other table
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 436 Views |
-
get values from other table

31 July 2009 at 7:01am
hi
i don't know how to explain so i will say everything from start:
polish => english translation:
Obiekty > Object
Strona > Pagemy ObcjecPage.php to adding objects
class ObiektyPage extends Strona {
static $db = array(
'Text' => 'text',
'Lat' => 'Varchar(50)',
'Lng' => 'Varchar(50)'
);
static $has_one = array(
);function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Main", new TextareaField("Text", "Text:",4),"Content");
$fields->addFieldToTab("Root.Content.coordinates", new TextField("Lat", "Lat:"));
$fields->addFieldToTab("Root.Content.coordinates", new TextField("Lng", "Lng:"));
return $fields;
}
}class ObiektyPage_Controller extends Strona_Controller {
}
my DataObjectManager
class Obiekty extends DataObject
{
static $db = array (
'Nazwa' => 'Text',
'Obiekt' => 'Text'
);
static $has_one = array (
'TrasyPage' => 'TrasyPage'
);
public function getCMSFields_forPopup() {
$stuff = DataObject::get("ObiektyPage");
$map = $stuff? $stuff->toDropdownMap():array();
return new FieldSet(
new TextField('Nazwa'),
new DropdownField('Obiekt','Obiekt',$map)
);
}
}and now when i add Object to the TrasaPage by DropdownField i also want to get coordinates $Lat and $Lng of chosed object but i don't know how
| 436 Views | ||
|
Page:
1
|
Go to Top |

