我尝试通过CJuiDialog中的ajax加载表单.表单已成功加载,但是当我提交表单或写入文本时,表单未验证且未提交.我尝试在renderPartial中设置"true"第四个参数,然后对话框窗口未打开.在控制台中,我收到了错误
$(...).对话框不是一个函数
在视图中我有这个:
Yii::app()->clientScript->registerScript(
"test",
"jQuery.ajax({
type: 'POST',
url: '".$this->createUrl("/Site/ShowForm")."',
success: function(html){
$('#form-test').html(html);
});
",
CClientScript::POS_READY); ?>
<div id="form-test"></div>
<?php $this->endWidget('zii.widgets.jui.CJuiDialog');
Run Code Online (Sandbox Code Playgroud)
我在控制器中的行为:
public function actionShowForm()
{
$model = new RegistrationForm;
if(Yii::app()->request->isAjaxRequest )
return $this->renderPartial('register', array('model' => $model),false,false);
}
public function actionRegister()
{
$model = new RegistrationForm;
$this->ajaxValidate($model);
$model->attributes =$_POST['RegistrationForm'];
if($model->validate())
{
$user = new User;
$user->attributes = $model->attributes;
if($user->save())
echo 1;
}
}
Run Code Online (Sandbox Code Playgroud)
和我的表格(register.php)
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'register-form',
//'enableClientValidation'=>true,
'enableAjaxValidation' => true,
'clientOptions' => array(
//'validateOnSubmit' …Run Code Online (Sandbox Code Playgroud) 从github克隆项目后,我得到了下一个错误:
警告:require_once(C:\ OpenServer\domains\MyBlog.test\web /../ app/bootstrap.php.cache):无法打开流:C:\ OpenServer\domains\MyBlog.test中没有此类文件或目录20号线上的\ web\app_dev.php
致命错误:require_once():无法打开所需的'C:\ OpenServer\domains\MyBlog.test\web /../ app/bootstrap.php.cache'(include_path ='.; c:/ openserver/modules/php /第20行的C:\ OpenServer\domains\MyBlog.test\web\app_dev.php中的PHP-5.5; c:/openserver/modules/php/PHP-5.5/PEAR/pear')
不幸的是在.gitignore文件中,我创建了下一个注释:
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
Run Code Online (Sandbox Code Playgroud)
那么,如何解决这个问题呢?
我执行php composer.phar更新命令,但它没有帮助.
我在knp分页中安装并覆盖模板.但是我需要显示有多少页面.例如:1页10页,5页10页等?我阅读官方文档,但我找不到ansver.