Exemple #1
0
$form = ActiveForm::begin();
?>

    <?php 
echo $form->errorSummary($model);
?>

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'content')->textarea(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'Topic_id')->dropDownList(\app\models\Topic::getTopicOptions(), array('prompt' => '-- Select a Topic --'));
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Exemple #2
0
}
?>
        </div>
        <div class="col-md-6">
            <h1>Forum</h1>
            <?php 
$form = ActiveForm::begin(['options' => ['class' => ['custom-form']]]);
?>
            <?php 
echo $form->field($newPost, 'title')->textInput(['maxlength' => true, 'placeholder' => 'Title...'])->label(false);
?>
            <?php 
echo $form->field($newPost, 'content')->textarea(['maxlength' => true, 'placeholder' => 'Content...'])->label(false);
?>
            <?php 
echo $form->field($newPost, 'Topic_id')->dropDownList(\app\models\Topic::getTopicOptions(), array('prompt' => 'Topic...'))->label(false);
?>

            <div class="form-group">
                <?php 
echo Html::submitButton('Create', ['class' => 'btn btn-success']);
?>
            </div>

            <?php 
ActiveForm::end();
?>
        </div>
    </div>
</div>