I am starting with Yii framework, and it is my first framework... to the point:
I have a form to a CMS to enter a new blog post, an article. I also created a debug view to see the data being passed before I save it in the database, the thing is that when I use the form 2 of the fields dont pass any data to the debug view... I hope that more experienced people might help see what I am doing wrong here.
my code:
-Form view(new.php)
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
?>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'Title') ?>
<?= $form->field($model, 'PublicationDate')->input('date') ?>
<?= $form->field($model, 'Content')->textarea(['rows' => 5]) ?>
<?= $form->field($model, 'tags') ?>
<div class="form-group">
<?= Html::submitInput('Submint', ['class' => 'btn-primary']) ?>
</div>
Article model(Article.php):
<?php
namespace app\models;
use yii\db\ActiveRecord;
class Article extends ActiveRecord{
public $tags;
public static function tableName()
{
return 'Article';
}
public function rules()
{
return[
[['Title', 'Content'], 'required'],
];
}
}
debug view:
<?php
use yii\helpers\Html;
?>
<p>You have entered the following information:</p>
<ul>
<li><label>Title</label>: <?= Html::encode($model->Title) ?></li>
<li><label>PublicationDate</label>: <?= Html::encode($model->PublicationDate) ?></li>
<li><label>Content</label>: <?= Html::encode($model->Content) ?></li>
<li><label>tags</label>: <?= Html::encode($model->tags) ?></li>
</ul>
thank you in advance for you time :)