我想从2个不同的模型创建一个表单,第一个是国家,第二个是文档.问题是我无法制作下拉列表,我总是得到错误.
这是代码,首先是我的controller.php部分
$model = new Country;
$model2 = new Product;
$this->performAjaxValidation(array($model, $model2));
if(isset($_POST['Country'],$_POST['Product']))
{
// populate input data to $model and $model2
$model->attributes=$_POST['Country'];
$model2->attributes=$_POST['Product'];
// validate BOTH $model and $model2
$valid=$model->validate();
$valid=$model2->validate() && $valid;
if($valid)
{
// use false parameter to disable validation
$model->save(false);
$model2->save(false);
$this->redirect('index');
}
}
...
$countriesIssued = Country::model()->findAll(array('select'=>'code, name', 'order'=>'name'));
...
$this->render('legalisation', array('model'=>$model, 'model2'=>$model2, 'documents'=>$documents, 'countriesIssued'=>$countriesIssued, 'countries'=>$countries, 'flag'=>$flag));
}
Run Code Online (Sandbox Code Playgroud)
在我的视图脚本中,我使用此代码
<?php $form = $this->beginWidget('CActiveForm', array(
'id'=>'user-form',
'enableAjaxValidation'=>true,
)); ?>
<?php echo $form->errorSummary(array($model,$model2)); ?>
<?php echo $form->dropDownList($model, …Run Code Online (Sandbox Code Playgroud) tcpdf 中是否有任何类可以使页面显示 -> 启用滚动默认选项(当我在 adobe 阅读器中打开它时),请帮忙,我在这上浪费了半天时间。我找到了这门课,但不是我需要的。
// set pdf viewer preferences
$pdf->setViewerPreferences($preferences);
Run Code Online (Sandbox Code Playgroud)