每個應用程序都有實例。當我嘗試propirat方式網址mananager選擇動作和奇怪驗證表單中的錯誤
'application/<slug:[\w+]+>/instance/create/' => 'instance/create',
'application/<slug:[\w+]+>/instance/<uuid:[\w0-9]+>/update/' => 'instance/update',
要打開鏈接,設置在
$this->menu=array(
array('label'=>'Create Instance', 'url'=>Yii::app()->createUrl('instance/create', array('slug' => $model->application->slug, 'uuid' => $model->uuid))),
array('label'=>'Update Instance', 'url'=>Yii::app()->createUrl('instance/update', array('slug' => $model->application->slug, 'uuid' => $model->uuid))),
形式的路徑我得到一個錯誤
include(optional_note.php): failed to open stream: No such file or directory
文件是什麼,並且必須做些什麼來滿足轉介?
更新
public function actionCreate()
{
$model=new Instance;
$model->application_id = $this->_application->id;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Instance']))
{
$model->attributes=$_POST['Instance'];
if($model->save())
$this->redirect(array('view','uuid'=>$model->uuid));
}
$this->render('create',array(
'model'=>$model,
));
}
更新
現在到了奇怪的行爲,得到下面的字段參數
Stack Trace
#3 \yii-1.1.12.b600af\framework\base\CModel.php(285): CValidator::createValidator("optional_note", Instance, "uuid", array(0 => "length", "max" => 128))
#4 \yii-1.1.12.b600af\framework\base\CModel.php(259): CModel->createValidators()
#5 \yii-1.1.12.b600af\framework\base\CModel.php(302): CModel->getValidators("uuid")
#6 \yii-1.1.12.b600af\framework\web\helpers\CHtml.php(1197): CModel->isAttributeRequired("uuid")
#7 \yii-1.1.12.b600af\framework\web\widgets\CActiveForm.php(563): CHtml::activeLabelEx(Instance, "uuid", array())
#8 \protected\views\instance\_form.php(25): CActiveForm->labelEx(Instance, "uuid")
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'uuid'); ?>
<?php echo $form->textField($model,'uuid',array('size'=>60,'maxlength'=>128)); ?>
<?php echo $form->error($model,'uuid'); ?>
</div>
<div class="row">
請出示在InstanceController – Sergey
您actionCreate通過堆棧跟蹤顯示調用表單時,打破了應用程序,不能字段驗證uuid,但它是自動填寫javascript – martinixs
你有另一個模型'optional_note'是'Instance'模型的形式的一部分嗎?它看起來像試圖加載,而不是找到模型類。 – Stu