简体   繁体   English

Yii ajax表单验证没有提交

[英]Yii ajax form validation is not submitting

Hi have the following form declared in a layout: 您好在布局中声明以下形式:

<?php
$regModel = new RegistrationForm();

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id' => 'registration-form',
    'action' => Yii::app()->createUrl('/utente/sign'),
    'type' => 'inline',
    'enableAjaxValidation' => true,
    'clientOptions'=>array(
        'validateOnChange'=>true,  
        'validateOnType'=>true,
        'validationDelay'=>10,
    ),
));

?>

the problem is that I don't receive any request on my controller. 问题是我的控制器没有收到任何请求。 I tried to monitor the Network Console but I don't see any request as I type in my form. 我试图监控网络控制台,但是当我在表单中输入时,我没有看到任何请求。

网络

I'm using ajax validation on many other forms in my application and they are working as expected. 我正在我的应用程序中的许多其他表单上使用ajax验证,它们按预期工作。

Any idea why this is not working? 知道为什么这不起作用吗?


SOLUTION Turned out that jQuery was registered twice. 解决方案结果证明jQuery已经注册了两次。 The first time by Yii and the second time by my template. 第一次由Yii和第二次由我的模板。 Once it was removed from my template everything started working as expected. 从模板中删除后,一切都按预期开始工作。

Check this Yii Ajax Validation 检查此Yii Ajax验证

Hope this would help. 希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM