17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1284 Views |
-
Fatal error: Call to a member function enumValues() on a non-object

17 October 2008 at 7:39pm
Hi!
I try to use select form as explain in guide but I have this error:Call to a member function enumValues() on a non-object in E:\_silverstripe_cms\itesa\mysite\code\Page.php on line 51
Why?
-
Re: Fatal error: Call to a member function enumValues() on a non-object

17 October 2008 at 10:26pm Last edited: 17 October 2008 10:27pm
What guide? Where?
What is on that line in the Page.php file as the debug error explains?
Sean
-
Re: Fatal error: Call to a member function enumValues() on a non-object

17 October 2008 at 10:50pm
in my page.php , under the page controller I put this function
function DropForm{
$field = new DropdownField(
'Country',
'Country',
singleton('MyObject')->dbObject('Country')->enumValues()
);
}and I create MyobjectField.php with this class
class MyObject extends DataObject {
static $db = array(
'Country' => "Enum('New Zealand,United States,Germany','New Zealand')"
);
} -
Re: Fatal error: Call to a member function enumValues() on a non-object

17 October 2008 at 10:51pm
the guide id here: http://doc.silverstripe.com/doku.php?id=dropdownfield
-
Re: Fatal error: Call to a member function enumValues() on a non-object

18 October 2008 at 9:45am Last edited: 18 October 2008 9:45am
MyobjectField.php MUST have a class inside called "MyobjectField". If this isn't the case, SS will not detect the class.
In your case, just rename MyobjectField.php to MyObject.php, run ?flush=1 and you're set.
Sean
| 1284 Views | ||
|
Page:
1
|
Go to Top |


