activeHiddenField doesn't render


I followed best practise - do server changes only with POST rq. So, I’m deleting a record. User click on <a href> link, which points to Controller/action, that renders confirmation form. Form with two buttons:

  • "No" - regular <a href> link, which points back to listing of records

  • "Yes" - submit button of Form. action attribute of Form points to Controller/action which deletes record from Model

I want to transport ID of deleting record in hidden form field. But for some "magic" reason, this field is not rendering into HTML code. So my ID is not present in final Controller/action which deletes record from Model.

Some code:


class Cornfimator extends CFormModel


	public $id;

	public function rules()


		return array(

			array('id', 'required'),

			array('id', 'safe'),

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





public function actionDelete()


	if (!isset($_GET['id'])) {


	} else {

		$model = new Cornfimator();

		$model->id = intval($_GET['id']);

		$this->render('delete', array('model'=>$model));



public function actionDeleteConfirmed()


	CVarDumper::dump($_POST, 4, true);echo '<br>';




<?php echo CHtml::beginForm('deleteConfirmed'); ?>

	<?php CHtml::activeHiddenField($model, 'id'); ?>

	<a href="<?php echo $this->createUrl('listing'); ?>">No</a>

	<?php echo CHtml::submitButton('Yes'); ?>

<?php echo CHtml::endForm(); ?>

HTML code

<form method="post" action="/deleteConfirmed">

	<a href="/admin/ratings">No</a>

	<input type="submit" value="Yes" name="yt0">


As you can see, hidden field is not present in HTML code. I don’t know why is this field ignored during rendering.

PLS help. THX.

Arrrgh, lost an hour of time for dumb error in View template:

<?php CHtml::activeHiddenField($model, 'id'); ?>

It is missing an echo command.

Please close topic.