public function actioncargagruposclases() { $criteria = new CDbCriteria(); $criteria->addCondition("codclase=:proved"); //$valor=$_POST['Cc']['codclase']; $criteria->params = array(":proved" => MiFactoria::cleanInput($_POST['Cc']['codclase'])); $data = CHtml::listData(Grupocc::model()->findAll($criteria), "codgrupo", "desgrupo"); echo CHtml::tag('option', array('value' => null), CHtml::encode('Escoja un grupo'), true); foreach ($data as $value => $name) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true); } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Grupocc the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Grupocc::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
echo $form->error($model, 'codclase'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'codgrupo'); ?> <?php $datos = CHtml::listData(Grupocc::model()->findAll(array('order' => 'desgrupo')), 'codgrupo', 'desgrupo'); echo $form->DropDownList($model, 'codgrupo', $datos, array('empty' => '--Llene el grupo--')); ?> <?php echo $form->error($model, 'codgrupo'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'desceco'); ?> <?php