I’m using the gii generated code but i would like to preset some of the form values.
At a guess I should be setting the value in the controller but my attempts at doing this have so far failed.
So I have in the staffcontroller
public function actionCreate()
{
$model=new Staff;
if(isset($_POST['Staff']))
{
$model->attributes=$_POST['Staff'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('create',array(
'model'=>$model,
));
}
the view makes use of the widget CActiveForm
I’m trying to preset a required value - companyid , and hide it from the user as they dont need to know about it.