CActiveForm->enableAjaxValidation <-> WebLogRoute conflict

Hi,

I just realized that ajaxValidation doesn’t work when using some sort of WebLogRoute as the JSON object will be corrupted by additional log output.

I don’t need to tell you that Firebug is an important feature when developing a website - deactivating the log route can’t be the solution.

I’m sorry if this was already posted somewhere.

Best regards,

Daniel

When i use CActiveForm i do not relay on the weblogroute, I just look at the XMLHttprequest in firebug. And i never saw the weblogroute interfering with the returned json object. Unless you use the ‘render()’ method to return the JSON object from the controller instead of simple print/echo or renderPartial.

I’m using exactly the example from yiic’s output when generating a form automatically:


// Ajax validation

		if(isset($_POST['ajax']) && $_POST['ajax']==='recipient-form')

		{

		 	echo CActiveForm::validate($model);

	 		Yii::app()->end();

		}

app()->end() raises the onEndRequest event - does CWebLogRoute catch this event? If so, the code snippet in yiic should be changed imo.

I know the Yii::app()->end() call raises the onEndRequest event, But not sure if that is the one registering the cweblogroute. Most likely, No. As the CWebLogRoute is shown on web pages and probably when using CController::render(). I don’t think that’s the reason. You showed the ajax validation function, What about the actual controller action?