Multi rules() in class CActiveRecord

Multi rules() in class CActiveRecord.

i have class ThaipostModel extends CActiveRecord.

i want to use ThaipostModel for search and insert.

  1. rules() for insert



	public function rules()

	{

		return array(

 			array('province, ampur, tumbon, remark', 'required'),

 			array('postcode', 'numerical', 'integerOnly'=>true),

			array('postcode', 'length', 'max'=>5),

			array('province, ampur, tumbon, remark', 'length', 'max'=>255),

		); 

        }  



  1. rules() for search



	public function rules()

	{

		return array(

 			array('postcode', 'numerical', 'integerOnly'=>true),

			array('postcode', 'length', 'max'=>5),

			array('province, ampur, tumbon, remark', 'length', 'max'=>255),

		); 

        }




in the same ThaipostModel

thank you.

use model scenario

Thank you.

ขอบคุณครับ

Thai proverb : a strand of hair hiding a mountain

เส้นผมบังภูเขา.

:) glad i could help