<?php $form = $this->beginWidget('CActiveForm', array('id' => 'om-order-item-sn-form', 'enableAjaxValidation' => false)); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'stock_serial_id'); ?> <?php echo $form->dropDownList($model, 'stock_serial_id', CHtml::listData(StockSerial::model()->findAll(array('order' => 'serial_number')), 'id', 'serial_number')); ?> <?php echo $form->error($model, 'stock_serial_id'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget(); ?>
/** * 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 StockSerial the loaded model * @throws CHttpException */ public function loadModel($id) { $model = StockSerial::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }