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.

Archive

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

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

registrationform


Reply

930 Views

Avatar
wave

4 December 2007 at 6:09pm Community Member, 1 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.