Jump to content
Larry Ullman's Book Forums

Custom Validators


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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...