Solve Problem This Ruels Validator

this is my code :D

what correct this code ?


	public function rules()

	{

		if(isset($_POST['ProfileViewModel']['username']))

		{

			$rulesArray[] = array('username', 'length', 'min' => 3, 'max' => 20, 'message' => 'Incorrect username (length between 3 and 20 characters).');

		}

		

		$rulesArray[] =	array('nickname', 'length', 'max'=>50);

		$rulesArray[] = array('gender', 'length', 'max'=>6);


		return $rulesArray;

	}

Hi javad,

I thinks your code is correct.

What’s your problem with this code?

Meanwhile I dont suggest to you that use "if(isset($_POST…" in rules.

Thanks.