21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 615 Views |
-
Using Map on silverstripe 3 dataobject

29 August 2012 at 12:12pm
Hi,
I'm using the following code to generate a dropdown list array.
function ... {
if($Pages = DataObject::get('RealestateSuburb'))
{
return $Pages->map('ID', 'Title', 'Any');
}
else
{
return array('No Objects found');
}
}The problem is in ss3 it doesn't insert the default first item, which is "Any" in this case. Worked fine in 2.4x.
Prob a simple thing.
Thanks
Regards
Scott -
Re: Using Map on silverstripe 3 dataobject

6 September 2012 at 2:34pm
You now use the emptyString value on the DropdownField for this, rather than having map() provide it. So, something like $field = new DropdownField('SuburbID', 'Suburb', $this->SuburbMap());
$field->setEmptyString('Any');
| 615 Views | ||
|
Page:
1
|
Go to Top |

