21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 206 Views |
-
Filtering a DropdownField

6 October 2011 at 3:17am
I have a FamilyPage and a dataobject "Jobs"
In FamilyPage I can create the DropDown:
function getCMSFields()
{
$fields = parent::getCMSFields();
$jobsob = DataObject::get('Jobs');
$fields->addFieldToTab('Root.Content.Band5', new DropdownField('JobTitle', 'Jobs', $Jobsob->map()));The dropdown works, except it show every job in the dataobject (which it should).
I can manually get the correct ones using:
$jobsob = DataObject::get('Jobs', 'FamiliesID = 226'); // I know 226 is the ID of one of the FamilyPages
$fields->addFieldToTab('Root.Content.Band5', new DropdownField('JobTitle', 'Jobs', $Jobsob->map()));How do I replace "FamiliesID = 226" with the ID of the FamilyPage that I am currently in?
Thanks,
Brian -
Re: Filtering a DropdownField

6 October 2011 at 5:13am
$jobsob = DataObject::get('Jobs', "FamiliesID = {$this->ID}");
| 206 Views | ||
|
Page:
1
|
Go to Top |

