douping3860
douping3860
2014-04-20 08:59

Yii ajax表单验证没有提交

已采纳

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.

Network

I'm using ajax validation on many other forms in my application and they are working as expected.

Any idea why this is not working?


SOLUTION Turned out that jQuery was registered twice. The first time by Yii and the second time by my template. Once it was removed from my template everything started working as expected.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dongshen2903 dongshen2903 7年前

    Check this Yii Ajax Validation

    Hope this would help.

    点赞 评论 复制链接分享