Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » registrationform

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 914 Views
  • wave
    Avatar
    Community Member
    1 Post

    registrationform Link to this post

    Hi every one
    i am new to silverstripe.
    i like the concept of this.my problem is i am trying to creating my own registration form just like Form folder.

    i am writing a function in my page i.e
    function HtmlFields(){
           $html = "<p>Go to Registration Form";
           $html .= "<a href = \"/Sample/register\">Register</a>";
           return $html;
        }
    then i am writing Sample.php
    class Sample extends Page_Controller {
       function __construct() {
          return parent::__construct(null);
       }
       
       
       
       /**
        * Get the latest 10 posts by this member
        */
       
       // Register
       
       function register() {
          $array= array(
             
             "Form" => $this->RegistrationForm(),
          );
          return $array;
       }

       function RegistrationForm() {
          $fields = new FieldSet(
          new HeaderField("Personal Details"),
          new TextField("FirstName","FirstName"),
          new TextField('MiddleName','MiddleName'),
          new TextField('LastName','LastName'),
          new CountryDropdownField("Country", "Country"),
          new TextField("Occupation", "Occupation"),

          new HeaderField("User Details"),
    new EmailField("Email", "Email"),
    new PasswordField("Password", "Password") ,
          new PasswordField("ConfirmPassword", "Confirm Password"),
          new TextField("Enter what you see","security_try(Enter what you see below)")
              );

             
          $actions = new FieldSet(
    new FormAction('doRegister', 'Register')
    );
          
          
          $validator = new RequiredFields('Email', 'Password','ConfirmPassword');
          return new Form($this, 'RegistrationForm', $fields, $actions,$validator);
       }
       
       
    }

    in.ss i am writing $Form

    but i am getting error:ContentController::RelativeLink() No URLSegment given on a '$this->class' object. Perhaps you should overload it

    please any one help me where i am doing worng . and tell me i am in correct way or not.

    sorry about my english.

    914 Views
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.