Problem With Ajax Validation In Chrome

Hi everyone,

I’m a noob both to Yii and this forum, but I desperately need some help. I’ve created a few create views, that are working nicely, except for one. I don’t know what’s up, but for some reason ajax validation for this particular form isn’t working when using Chrome, but works just as expected in Firefox. I don’t have similar problems with any other forms, and the error message in Chrome’s dev console isn’t really helping at all:

POST (my dev site's url)/ad/create  jquery.js:8434

send jquery.js:8434

jQuery.extend.ajax jquery.js:7986

$.fn.yiiactiveform.validate jquery.yiiactiveform.js:356

(anonymous function) jquery.yiiactiveform.js:95

Headers for the request are ok, but there’s no response from the server whatsoever. Here’s the view in question:



        if($("#Ad_types_10").is(":checked")) {


        } else {



        $("#Ad_types_10").change(function() {

            if($(this).is(":checked")) {


            } else {







<div class="form">

<?php $form=$this->beginWidget(






)); ?>

    <div class="row-fluid">

	    <p class="note">Fields with <span class="required">*</span> are required.</p>

	    <?php echo $form->errorSummary($model); ?>

	    <?php echo $form->textFieldRow($model,'title',array('size'=>60,'maxlength'=>128)); ?>

        <?php echo $form->radioButtonListRow(




        ); ?>

        <?php echo $form->checkBoxListInlineRow(




            array("hint"=>"Select all that apply.")

        ); ?>

        <span id="other_text_wrapper">

	    <?php echo $form->textAreaRow($model,'other_text',array('rows'=>6, 'cols'=>50)); ?>


        <?php echo $form->radioButtonListRow(




        ); ?>


            echo CHtml::tag("div", array("class"=>"control-group"));

            echo $form->labelEx($model,'reach_estimate', array("class"=>"control-label"));

            echo CHtml::tag("div", array("class"=>"controls"));

            echo $form->textField($model,'reach_estimate');

            echo " / ";

            echo $form->dropDownList($model,'reach_unit', $model->getReachUnits());

            echo "<p>".$form->error($model,'reach_estimate')." ".$form->error($model,'reach_unit')."</p>";

            echo CHtml::closeTag("div");

            echo CHtml::closeTag("div");



            echo CHtml::tag("div", array("class"=>"control-group"), false, false);

            echo $form->labelEx($model,'price_min', array("class"=>"control-label"));

            echo CHtml::tag("div", array("class"=>"controls"), false, false);

            echo $form->textField($model,'price_min',array("placeholder"=>"min"));

            echo " - ";

            echo $form->textField($model,'price_max',array("placeholder"=>"max"));

            echo "<p>".$form->error($model,'price_min')." ".$form->error($model,'price_max')."</p>";

            echo CHtml::tag("p", array("class"=>"help-block"), "Please enter price range.");

            echo CHtml::closeTag("div");

            echo CHtml::closeTag("div");


        <?php echo $form->textAreaRow($model,'description',array('rows'=>6, 'cols'=>50)); ?>


    <div class="row buttons form-actions">

        <?php $this->widget(



                'buttonType' => 'submit',

                'type' => 'primary',

                'label' => 'Save'


        ); ?>


<?php $this->endWidget(); ?>

</div><!-- form -->

I’m stumped. :( Any help would be greatly appreciated!

Hi Sachlaus, welcome to the forum.

I think your output HTML has errors here … you have failed to specify $closeTag parameters to false in CHtml::tag()s.

So the orphaned closing "div" tags could mess up the form.

Thanks for the quick reply, and for the good catch! Unfortunately fixing that didn’t solve the problem.

Hmm, then I would try disabling the ajax validation and see what will happen in different browsers.

BTW, are you using the yii built-in version of jQuery?

I disabled ajax validation, and then the errors stop appearing. Server-side validation has been working the whole time regardless of browser and whether ajax validation is enabled or not. I also tried disabling my custom js functions while ajax validation was enabled, but that didn’t affect the problem either.

Yes, I’m using the built-in version of jQuery.

Now I think I should have started by asking what exactly have been the error.

Could you describe the error as clearly as possible? What did you get when you have fired an ajax validation? And what warnings and errors does the developer tool report if any?

But you might have reached the 3 posts limit … :(

I solved the problem! I figured out the cause while fixing another problem, and the cause was in fact the AdBlock extension. It was blocking the reply, since my controller was named “Ad”. That’s why there was no proper error, since nothing went wrong per se, except that the reply from the server was blocked.

Lessons to learn:

  1. Remember that browser extensions may interfere with your code

  2. Remember not to ever, ever name anything “Ad” ;D