0

私はcakephpが初めてで、アプリを構築しようとしています。私はいくつかのテキストフィールドを持っています。それらを検証したいと思います。Cakephp.org の cakephp チュートリアルに従って、次のことを行いましたが、テキストフィールドの近くに検証メッセージが表示されません。以下は私のコードです:

ctp:

   <?php echo $this->Form->text('Rideoffer.PickFrom', 
                                                array('class' => 'address-text',
                                                    'value' => $dropFrom));  ?>

モデル:

public $validate = array(
         'PickFrom' => array(
        'rule' => 'notEmpty',
        'message' => 'Cannot leave this field blank.'
    ),
    //'PickFrom' => 'notEmpty',
    'DropAt' => 'notEmpty',
   // 'born'  => 'date'
);

どこで間違っていますか?どうすれば解決できますか?

4

2 に答える 2

0

dropat でコンマを使用しました

public $validate = array(
         'PickFrom' => array(
        'rule' => 'notEmpty',
        'message' => 'Cannot leave this field blank.'
    ),
    //'PickFrom' => 'notEmpty',
    'DropAt' => 'notEmpty'
   // 'born'  => 'date'
);
于 2013-03-05T05:19:24.997 に答える
0

この Form->text('Rideoffer.PickFrom', array('class' => 'address-text', 'value' => $dropFrom, 'error'=>'Cannot leave this field blank.') を使用できます); ?>

于 2013-03-05T14:39:27.067 に答える