1

In _form.php I am trying to use this simple code and I am getting the error:

<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\State;
/* @var $this yii\web\View */
/* @var $model app\models\State */
/* @var $form yii\widgets\ActiveForm */
 $model = new State();
?>
<?= $this->render('_form', [
 'model' => $model,
 ]) ?>

Why I am getting this error. As the same code was working fine.

asked Nov 21, 2014 at 10:00
1

2 Answers 2

3

If that is indeed code from "_form.php", then the following code is recursively rendering _form.php inside itself:

<?= $this->render('_form', [
 'model' => $model,
 ]) ?>
answered Nov 22, 2014 at 14:35
0

Joshi is correct, and the reason it's happening is because that you're calling render() instead of renderPartial(). Change your code to this, and the error will disappear and your partial will show as expected:

<?= $this->renderPartial('_form', [
 'model' => $model,
 ]) ?>
answered Nov 4, 2015 at 14:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.