Help me CmsInput


(ananascimento) #1

Hi,

I am using CmsInput in my project to filter in the comment field, but I did tests using hello word scritp and it is writing to the database without applying the filter. Can someone help me?

my controller:

    if (isset($_POST['comments'])) {          
        
        $model->attributes = Yii::app()->input->xssClean($_POST['comments']);             
        
        $validationMessage = $this->getValidationMessage($model);

        if ($validationMessage == ConstantesSistema::EMPTY_ARRAY_STRING && $model->save()) {
            Yii::app()->user->setFlash('success', Yii::t('app', 'message.success'));
            echo CJSON::encode(array('status' => 'success', 'message' => Yii::t('app', 'message.success')));
        } else {
            echo $validationMessage; //already in json format
            Yii::app()->end();
        }