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:
Yii::app()->clientScript->registerScript("adFormScripts",'
$(function(){
if($("#Ad_types_10").is(":checked")) {
$("#other_text_wrapper").show(0);
} else {
$("#other_text_wrapper").hide(0);
}
$("#Ad_types_10").change(function() {
if($(this).is(":checked")) {
$("#other_text_wrapper").show();
} else {
$("#other_text_wrapper").hide();
}
});
});
');
?>
<div class="form">
<?php $form=$this->beginWidget(
'bootstrap.widgets.TbActiveForm',
array(
'id'=>'ad-form',
'enableAjaxValidation'=>true,
'type'=>'horizontal',
)); ?>
<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(
$model,
'repeating',
$model->getRepeatingOpts()
); ?>
<?php echo $form->checkBoxListInlineRow(
$model,
'types',
$model->getAdTypes("label"),
array("hint"=>"Select all that apply.")
); ?>
<span id="other_text_wrapper">
<?php echo $form->textAreaRow($model,'other_text',array('rows'=>6, 'cols'=>50)); ?>
</span>
<?php echo $form->radioButtonListRow(
$model,
'visibility_range',
$model->getVisibilityRanges()
); ?>
<?php
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");
?>
<?php
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>
<div class="row buttons form-actions">
<?php $this->widget(
'bootstrap.widgets.TbButton',
array(
'buttonType' => 'submit',
'type' => 'primary',
'label' => 'Save'
)
); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
I’m stumped. Any help would be greatly appreciated!