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.

Customising the CMS /

Ragistation form create but admin page have problem


2 Posts   1183 Views


Community Member, 57 Posts

15 June 2009 at 9:30pm

Edited: 15/06/2009 9:34pm

i used help for coding

and code is :
class RegistrationForm extends Page {

class RegistrationForm_Controller extends Page_Controller {

   private $defaultGroupID = 2;

   * This function lets you put a form on your page, using $Form.
   function Form() {
      return new Form($this, "Form", new FieldSet(

         // List your fields here
         new TextField("FirstName", "First name"),
         new TextField("Surname"),
         new EmailField("Email", "Email address")

      ), new FieldSet(

         // List the action buttons here
         new FormAction("SignupAction", "Sign up")

      ), new RequiredFields(

         // List the required fields here: "Email", "FirstName"


   * This function is called when the user submits the form.
   function SignupAction($data, $form) {

      // Create a new Member object and load the form data into it
      $member = new Member();

      // Write it to the database. This needs to happen before we add it to a group

      // Add the member to group. (Check if it exists first)
      if($group = DataObject::get_one('Group', "ID = $this->defaultGroupID")) {

         // Redirect to a page thanking people for registering


         // Redirect to a failure page



i have two problem:
1. dropdown list create problem.
2. data base have data but how to access this data.

i haven't any idea so please help me and send some help of links and suggestion please send....


Forum Moderator, 5513 Posts

16 June 2009 at 5:29pm

You can view Members in the Security Section in the CMS.

If you want to get a list of Members on the site you just need to DataObject::get('Member');