7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » The default Login Form - add default value's
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 2433 Views |
-
Re: The default Login Form - add default value's

10 August 2010 at 2:55am
The Object::useCustomClass() needs to be in your _config.php. This needs to be in CustomLoginForm.php:
class MyLoginForm extends MemberLoginForm {
public function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true) {
parent::_contstruct($controller, $name, $fields, $actions, $checkCurrentUser);
$this->Fields()->fieldByName('Email')->setValue('Some default value');
}
} -
Re: The default Login Form - add default value's

10 August 2010 at 4:05am
You mean the config should look like this?
Object::useCustomClass('MemberLoginForm', 'CustomLoginForm');
Object::add_extension('Group', 'GroupDecorator');
Object::useCustomClass('MemberLoginForm', 'MyLoginForm');Placed you function inside CustomLoginForm.php
but website gives error
What to do?
-
Re: The default Login Form - add default value's

10 August 2010 at 4:47am
What does "gives error" mean?
-
Re: The default Login Form - add default value's

10 August 2010 at 5:02am
The normal error from silverstripe when you have an error in your code.
You know:
WEBSITE ERROR
on a grey background in a blue-ish square.
-
Re: The default Login Form - add default value's

10 August 2010 at 5:50am
Get your site into dev mode so we can see the error.
Director::set_environment_type('dev');
You shouldn't be running in live mode while you're still developing.
-
Re: The default Login Form - add default value's

10 August 2010 at 7:48am Last edited: 10 August 2010 7:49am
[User Error] Uncaught ReflectionException: Class MyLoginForm does not exist
GET /bedrijfsprofielLine 89 in /public/sites/www.url.nl/sapphire/core/Object.php
Source80 * @param string $class the class name
81 * @param mixed $arguments,... arguments to pass to the constructor
82 * @return Object
83 */
84 public static function create() {
85 $args = func_get_args();
86 $class = self::getCustomClass(array_shift($args));
87
88 if(version_compare(PHP_VERSION, '5.1.3', '>=')) {
89 $reflector = new ReflectionClass($class);
90 return $reflector->newInstanceArgs($args);
91 } else {
92 // we're using a PHP install that doesn't support ReflectionClass->newInstanceArgs()
93
94 $args = $args + array_fill(0, 9, null);
95 return new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8]); -
Re: The default Login Form - add default value's

10 August 2010 at 8:10am
Did you create MyLoginForm.php?
-
Re: The default Login Form - add default value's

10 August 2010 at 8:15am Last edited: 10 August 2010 8:16am
At first i didn't create the MyLoginForm php, because the function was added on rule 1 of CustomLoginForm.php
Now i added the function to MyLoginForm.php - and deleted the function from customloginform.php
After dev/build
When I enter the page:
[User Error] Uncaught Exception: Object->__call(): the method '_contstruct' does not exist on ''
GET /bedrijfsprofielLine 576 in /public/sites/www.url.nl/sapphire/core/Object.php
| 2433 Views | ||
| Go to Top | Next > |
