Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » Custom login form / problems and best practice

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

Page: 1
Go to End
Author Topic: 4027 Views
  • dkhan
    Community Member
    1 Post

    Custom login form / problems and best practice Link to this 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

  • dospuntocero
    Community Member
    54 Posts

    Re: Custom login form / problems and best practice Link to this post

    does your LeftLogiForm.php extends Security.php ?

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.