Commit a33b71b565f35a496f7edef06ecf694c5588c1ec
1 parent
7138a911
test
Showing
2 changed files
with
12 additions
and
2 deletions
Show diff stats
common/models/Vacancy.php
... | ... | @@ -64,7 +64,7 @@ |
64 | 64 | { |
65 | 65 | return [ |
66 | 66 | [ |
67 | - [ 'name', 'description', 'city', 'link', 'specializationInput' ], | |
67 | + [ 'name', 'description', 'city', 'link' ], | |
68 | 68 | 'required', |
69 | 69 | ], |
70 | 70 | [ |
... | ... | @@ -72,7 +72,7 @@ |
72 | 72 | 'string', |
73 | 73 | ], |
74 | 74 | [ |
75 | - [ 'employmentInput', ], | |
75 | + [ 'employmentInput', 'specializationInput' ], | |
76 | 76 | 'safe', |
77 | 77 | ], |
78 | 78 | [ | ... | ... |
frontend/controllers/AccountsController.php
... | ... | @@ -990,6 +990,11 @@ |
990 | 990 | if(!empty( $post )) { |
991 | 991 | $vacancy->load($post); |
992 | 992 | $vacancy->validate(); |
993 | + if(empty($vacancy->specializationInput)) { | |
994 | + $vacancy->addError('specializationInput', 'Cannot be blank'); | |
995 | + } else { | |
996 | + $vacancy->clearErrors('specializationInput'); | |
997 | + } | |
993 | 998 | if(!$vacancy->hasErrors()) { |
994 | 999 | $vacancy->save(); |
995 | 1000 | Fields::saveFieldData(Yii::$app->request->post('Fields'), $vacancy->vacancy_id, Vacancy::className(), 'ru'); |
... | ... | @@ -1049,6 +1054,11 @@ |
1049 | 1054 | if(!empty( $post )) { |
1050 | 1055 | $vacancy->load($post); |
1051 | 1056 | $vacancy->validate(); |
1057 | + if(empty($vacancy->specializationInput)) { | |
1058 | + $vacancy->addError('specializationInput', 'Cannot be blank'); | |
1059 | + } else { | |
1060 | + $vacancy->clearErrors('specializationInput'); | |
1061 | + } | |
1052 | 1062 | if(!$vacancy->hasErrors()) { |
1053 | 1063 | $vacancy->save(); |
1054 | 1064 | Fields::saveFieldData(Yii::$app->request->post('Fields'), $vacancy->vacancy_id, Vacancy::className(), 'ru'); | ... | ... |