Hello all

I am using CakePHP 1.2 and I am trying to implement a simple form data
validation. The thing is that the data validation works on my local
machine but it doesn't work on my rental server (Linux FreeBSD
server).

Here's my model....
<?php
class Inventory extends AppModel
{
    var $name = 'Inventory';
    var $validate = array(
        'make' => array(
            'rule'      => 'notEmpty',
            'message'   => '入力必須!'
        )
   );
}
?>

and view template....

<?php echo $form->create( 'Inventory', array( 'action' =>
'index' ) ); ?>
<?php echo $form->input(
                "make",
                array(
                        "div" => false,
                        "label" => ":Maker",
                ) ); ?>
<?php echo $form->end( 'Send' ); ?>

Here's my controller....

<?php
class InventoriesController extends AppController
{
    var $name = 'Inventories';
    var $uses = array( 'Inventory' );

    function index()
    {
        if( $this->data )
        {
            $this->Inventory->set( $this->data );
            if( $this->Inventory->validates() ) { /* some logic */ }
                else { /* some other logic */ }
        }
    }
}
?>

The problem is that the data gets set on the model, but the validates
function always return true, even though I am submitting a blank form.

What could be going wrong?

Thanks and Regards
ShiVik

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to