create form as modal doesn't display validations

So i am popping up my create new record form as a modal dialog via




return $this->renderAjax('create', ..



Problem is, none of the validations show up with the fields like this - ie, when you leave a field blank, normally it says “xxx cannot be blank” , whereas as modal, it doesn’t ?

Any ideas why, how to fix ?

Can you make sure you have set ‘enableAjaxValidation’=>true and provided UNIQUE ID in your modal form?

If you have, then make sure you have about the request if its AJAX in your action.

Example:

if (Yii::$app->request->isAjax && $model->load ( Yii::$app->request->post () )) {

		Yii::$app->response->format = Response::FORMAT_JSON;


		return ActiveForm::validate ( $model );


	}

After doing all this, I hope your validations will work in modal view too.