Post Model

var $validate = array(
                        'content' => array(
                                'rule' => 'notEmpty',
                                'required' => true
                        )
                );

add.ctp under posts/

<?=$this->Form-
>create('Posts',array('id'=>'articleform','enctype'=>'multipart/form-
data','class'=>'form'));?>
<?=$this->Form-
>input('content',array('type'=>'textarea','label'=>'Quotes'));?>
<?php echo $this->Form->end('Add Quote'); ?>

posts_controller.php
function add()
{
$this->Post->set($this->data);
if ($this->Post->validates()) { $this->Post->create(); $this->Post-
>save($this->data) } else{ //session set and redirect.}

Whether i enter value or not in content textarea, it always goes to
the else part

What do i do wrongly?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to