Jump to:

2002 Posts in 1422 Topics by 616 members

Form Questions

SilverStripe Forums » Form Questions » Getting Member_Validator to work

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

Page: 1
Go to End
Author Topic: 664 Views
  • david.brunelle
    Avatar
    Community Member
    5 Posts

    Getting Member_Validator to work Link to this post

    I'm trying to do some front end member registration, using the examples given in the English version of "SilverStripe - The Complete Guide to CMS Development" (See page 187). The examples in the book and the documentation for the class (http://api.silverstripe.org/2.4/sapphire/security/Member_Validator.html) seem to indicate the Member_Validator should check for an existing member using the provided email address.

    This doesn't seem to be the case. Anyone know why Member_Validator may not be checking for an existing member? Here's code, reduced for brevity:

    <?php
    class FundraiserContact extends Member {
       static $db = array(
          "PhoneNumber" => "Varchar(100)",
          "JobTitle" => "Varchar(255)"
       );
       
       public function getFrontendFields() {
          $fields = $this->scaffoldFormFields(array(
             'restrictFields' => array(
                'FirstName',
                'Surname',
                'JobTitle',
                'PhoneNumber',
                'Email',
                'Password'
             ),
             'fieldClasses' => array(
                'Email' => 'EmailField',
                'Password' => 'ConfirmedPasswordField'
             )
          ));
          
          return $fields;
       }

    }

    <?php
    class FundraiserContactDetailStep extends MultiFormStep {
       ...

       function getValidator() {
          return new Member_Validator(
             'FirstName',
             'Surname',
             'PhoneNumber',
             'Email',
             'Password'
          );
       }
    }

    664 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.