I am having trouble implementing form validation in 1.2 beta.
Something weird is occurring as my controller seems to be ignoring
anything I put in the $validate array, not to mention anything in
beforeValidate().

controller...

    function register() {
                                $this->pageTitle = __('registerTitle', true);

                                if (!empty($this->data)) {
                                                pr($this->data);
                                                pr($this->validateErrors());
                                                if ($this->User->save()) {
                                                                pr('ccc');
                                                                // set session
                                                                // set cookie
                                                                // set flash msg
                                                                // redirect?
                                                }
                                }
    }

model...

    public $validate = array(
       'username' => array(
            'alphanumeric' => array(
                'rule' => 'alphaNumeric',
                'message' => 'usernameError'
             ),
            'between' => array(
                'rule' => array('between', 8, 20),
                'message' => 'usernameError'
            ),
                                ),

I even replaced the $validate with something simpler...

public $validate = array(;username' => 'required');

beforeValidate() has nothign of note in it...

    public function beforeValidate() {
                                pr('beforeValidate');
                                pr($this->data);
                                pr($this->validateErrors());
                                exit();
                }

I get no output form beforeValidate(), not any errors for username.

Any idea?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to