File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 33namespace app \controllers ;
44
55use yii \web \Controller ;
6+ use app \models \AddForm ;
67
78class UserController extends Controller {
89
@@ -15,7 +16,9 @@ public function actionAdmin() {
1516 }
1617
1718 public function actionAdd () {
18- return $ this ->render ('add ' );
19+
20+ $ model = new AddForm ();
21+ return $ this ->render ('add ' , compact ('model ' ));
1922 }
2023
2124 public function actionDelete () {
Original file line number Diff line number Diff line change 44
55use yii \base \Model ;
66
7- class PostForm extends Model {
7+ class AddForm extends Model {
88 public $ title ;
99 public $ text ;
1010}
Original file line number Diff line number Diff line change 11<?php
22use yii \helpers \Html ;
3+ use yii \widgets \ActiveForm ;
34?>
45
56<div class="wrap">
1112 </ul>
1213 </div>
1314</div>
15+
16+ <?php $ form = ActiveForm::begin () ?>
17+ <?= $ form ->field ($ model , 'title ' ) ?>
18+ <?= $ form ->field ($ model , 'text ' ) ?>
19+ <?= Html::submitButton ('Добавить ' , ['class ' => 'btn btn-success ' ]) ?>
20+ <?php ActiveForm::end () ?>
You can’t perform that action at this time.
0 commit comments