我有一个问题,验证一个提交的电子邮件地址是否是唯一的数据库。当用户注册时,我需要验证电子邮件地址是否存在,所有其他验证都正常工作。
在Yii 2中验证使用Ajax表单时是否缺少步骤。
用户单击CTA在站点/索引上注册
use yii\bootstrap\Modal;
use frontend\models\Register;
use yii\helpers\Html;
use yii\helpers\Url;
...
Modal::begin([
'id' => 'modal',
'size'=>'moda
Ajax验证是不触发的,需要帮助找出我的代码有什么问题,挣扎花了足够长的时间让我在这里寻求帮助,所以请帮助。有一些注释代码,它是在尝试使其工作时使用的。获取500个内部服务器错误:
{“名称”:“异常”,“消息”:“属性名称必须只包含单词字符。”
UserController
public function actionRegister()
{
$model = new Users();
if (Yii::$app->request->isAjax && $model->load(Yii::$app->reques
我已经创建了一个yii2控制器,用于显示来自数据库的特定用户的统计数据。有一个对我的控制器操作执行的ajax请求,但是我想限制这个操作只允许使用POST方法。
<?php
use yii\web\Response;
namespace app\controllers;
use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\Response;
use yii\filters\VerbFilter;
use app\models\StatsModel;
class DataControlle
我在网格视图更新、排序、分页时出错了。页面加载时,通过AJAX很好地加载网格。但是,在单击头以排序行时,或单击任何分页按钮时,我都会看到一个错误:
Uncaught TypeError: Object [object Object] has no method 'popover'
jQuery.yiiGridView.afterAjaxUpdate
$.extend.success
fire
self.fireWith
done
callback
在Firebug中,我得到了:
TypeError: jQuery(...).popover is not a functi
我希望在通过ajax提交表单时有一个进度条,但问题是如果表单已提交,则进度条不起作用,并且当进度条显示时表单未提交。我无法理解发生了什么,我隐藏了( data:{tenure_id,due- on.When })进度条已显示,但表单未提交。
表格
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use app\models\Tenure;
use app\models\Sectors;
/* @var $this yii\web\View */
/* @var $
我有两个模型A和B,在模型A表单中动态添加模型B,但当我单击创建按钮时,我没有在POST.where中获取模型B数据我做错了请帮助。
模型A表单(视图)
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
use yii\web\View;
$script = <<< JS
$.ajax({
type :'POST',
我使用yii2 (2.0.13)。当我用ajax发送数据时,返回响应包含一个错误。
我的代码:
namespace frontend\controllers;
use Yii;
use yii\rest\ActiveController;
class CityController extends ActiveController
{
public $modelClass = 'frontend\models\City';
public function actions()
{
$actions = parent::actio