getPrimaryKey() question

Hello everyone!

I have some code:

public function actionVchytel2()


		$v2 = $_POST['vchhotid'];

		$vch_hot = JosPpnz::model()->findByPk($v2);

		$vch_hot_ol = new Vch2;







		echo $vch_hot_ol->getPrimaryKey();



This is my controller’s action which is activated by this ajax request:

<?php echo CHtml::dropDownList('v2','', array(), array('empty' => '','class'=>'input input_r',


'ajax' => array(









The problem is that the action does not return the expected primary key.

Any suggestions?

Thank you.

I solved the problemm. It was my mistake to give ‘prizv’ field in my database too short length, That’s why data was not stored in the database and that’s why getPrimaryKey() returned null.