Title: Yii2 Rules customization
Tags: yii2
Question: I have a rule like this 

```public function rules()
        {
            return [
                [ [ 'movie_id']'required' ],
            ];
        }
```

and in my form if i don't select movie i get 'movie cannot be blank'. how can i change that sentence to a custom one?  

``` public function attributeLabels()
        {
            return [
                'id'              =&gt; Yii181a:6c1c:918f:f3a4:2e8c:61d6:1a08:6b16t( 'app', 'Movie' ),
                   ];
        }
```

i think if i change the value in attributelabels i can change it, is there any other way i can change?


Here is the accepted answer: Try this:

```public function rules()
{
      return [
           [ [ 'movie_id'], 'required', 'message' =&gt; 'your-custom-message' ],
      ];
}
```



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:07/10/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<yii2>', 'Title': 'Yii2 Rules customization', 'ViewCount': 58, 'id': 31332328, 'user_AboutMe': '<h1>SOreadytohelp</h1>\n', 'user_AccountId': 5623465.0, 'user_DisplayName': 'Bloodhound', 'user_Reputation': 2866.0, 'user_Views': 328.0, 'user_id': 5034964.0}}