Edward Posted September 18, 2014 Share Posted September 18, 2014 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 More sharing options...
Edward Posted September 18, 2014 Author Share Posted September 18, 2014 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 More sharing options...
Edward Posted September 18, 2014 Author Share Posted September 18, 2014 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 More sharing options...
Larry Posted September 19, 2014 Share Posted September 19, 2014 Yeah, that kind of would surprise me if it wouldn't work for Ajax validations. Glad you got it worked out and thanks for sharing. Good luck coding! Link to comment Share on other sites More sharing options...
Recommended Posts