Jump to content
Larry Ullman's Book Forums

Custom Validators


Edward
 Share

Recommended Posts

I have discovered that Yii will not run custom validators when I have enableAjaxValidation enabled. I have tired everything, setting validators to safe using scenerios etc, nothing works. When i submit my form without ajax and JS Client Options disabled the validator works.

 

Did anyone else suffer from this problem, or know how to fix it?

Link to comment
Share on other sites

Its okay got it working i stripped down my controller. So now i know its something in my code around it that is causing the problem. Edward is still not too old yet and his detective work is still up to scratch after his many years in those old spooky mansions in "Alone in the Dark".

 

Hope all is well for you Larry, Christmas is coming soon, its coding all the way till then....... :)

Link to comment
Share on other sites

The problem happened because i used an echo in my controller like this:

if(ItemShippingInternational::model()->isInternationalShippingAvailable($modelItem->itemItemShippingInternational))
{
    echo 'International Shipping is available!';
}

$modelItem = new Item('scenerio-name');	

$this->performAjaxValidation($modelItem);
		
if(isset($_POST['Item']))

I think i spent about 6 hours on this, thanks to the person above that clicked the switch and got me out of this mess.

Link to comment
Share on other sites

 Share

×
×
  • Create New...