I'm on Windows using XAMPP and CakePHP.  No issues.

Check and make sure you're putting all the code in the right files.
For example if your Post model isn't in /app/models/post.php Cake will
not find it and silently use the base model instead.  Sounds like
what's happening with you.

-Matt
http://www.pseudocoder.com



On Jan 24, 4:54 am, Elliot Tucker <[email protected]>
wrote:
> Hi,
> Not a newby at PHP or MVC  but I am a newby Cake Baker.
>
> I'm going through the example blog application (http://
> book.cakephp.org/view/218/Example-Applications) but for some reason
> the Validation doesn't work.  When notEmpty validation is set up on
> the fields I can still add post with empty title and body.  I've tried
> all kinds of different validations rules in the Posts but they don't
> ever get picked up.
>
> It feels like a bug, poss w/ CakePHP+XAMPP as I haven't had the
> opportunity to try on Linux.  I've even tried all the different
> validation methods from the manual..nothing.  No errors either.
>
> Code below (verbose fromhttp://book.cakephp.org/view/338/Data-Validation)
>
> Any help would be much appreciated, it's frustrating to be stumped so
> early on!
>
> Cheers.
>
> Elliot.
>
> First off, hear is the model
> ###############################
> <?php
> class Post extends AppModel
> {
>         var $name = 'Post';
>
>         var $validate = array(
>                 'title' => array(
>                         'rule' => 'notEmpty'
>                 ),
>                 'body' => array(
>                         'rule' => 'notEmpty'
>                 )
>         );}
>
> ?>
> ##############################
>
> And the relevent parts from the controller:
> ##############################
> <?php
> class PostsController extends AppController {
>         var $name="Posts";
>                 function add() {
>                 if (!empty($this->data)) {
>                         if ($this->Post->save($this->data)) {
>                                 $this->flash('Your post has been saved.', 
> '/posts');
>                         }
>                 }
>         }}
>
> ##############################
>
> And for good luck, a add view:
> ##############################
> <h1>Add Post</h1>
> <?php
> echo $form->create('Post');
> echo $form->input('title');
> echo $form->input('body', array('rows' => '3'));
> echo $form->end('Save Post');
> ?>
> ##############################
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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