One possibility is that your input form is named incorrectly, that's the
only thing I can think of off the top of my head. Could you post your view
code as well, that way I can get an idea as to how it is all working (or not
working) together.
On Jan 22, 2008 2:05 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> 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?
> >
>
--
In the name of Life, Liberty, and the pursuit of my sanity.
Siebren Bakker(Aevum Decessus)
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d- s+: a19 C++++ UL++ P L++
!E W++ N(-) o? K? w(+) O? M-- V?
PS+ PE Y- PGP- t+ 5? X- R tv--
b++ Di D+ G+ e h! r y-
------END GEEK CODE BLOCK------
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---