Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Custom login form / problems and best practice

Go to End

2 Posts   4671 Views


Community Member, 1 Post

9 January 2009 at 3:37am

Edited: 09/01/2009 3:40am


I am currently doing my first site with SS and I am quite amazed but I have some minor problems.

I want to have a login form at the left on every page.

For that I added this to my Page.php:

	 * Shows login Form
	 * @return Form
	function LeftLoginForm() {
		return new LeftLoginForm($this, "LeftLoginForm", new FieldSet(
		// Form fields
		new EmailField("Email", "E-Mail"),
		new PasswordField("Password", "Passwort")

I also created a class LeftLogiForm where I override dologin():

	// this function is overloaded on our sublcass (this) to do something different
	public function dologin($data) {
		// If this is left out the standard form will show inside content
		// which causes the form handling to break

Inside my template I have $LeftLoginForm where the form should go to.
This works fine so far. All System messages are shown inside this form area, etc..

First question: Is this how it is intended to be done, or are there better ways?

Now here is the real problem:

If I click on 'Forgot my password' the form shows up inside the content area.
This form works, but the form on the left is broken because the form action changes to /Security/?executeForm=LeftLoginForm.
If I submit this form I end up with this error message:

user_error(Object::__call() Method 'LeftLoginForm' not found in class 'Security',256)
line 199 of Object.php


What is happening here? What does executeForm do and how can I fix this problem?

Is it possible to show the forgot password form where the login form was?

Thanks in advance

Daniel Khan


Community Member, 54 Posts

5 March 2009 at 12:01am

does your LeftLogiForm.php extends Security.php ?