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.

Form Questions

Custom login form / problems and best practice


2 Posts   4041 Views


9 January 2009 at 3:37am (Last edited: 9 January 2009 3:40am), Community Member, 1 Post


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


5 March 2009 at 12:01am Community Member, 54 Posts

does your LeftLogiForm.php extends Security.php ?