PHP Classes

File: views/test/_form.php

Recommend this page to a friend!
  Classes of Uldis Nelsons   YII2 Framework PHP Init   views/test/_form.php   Download  
File: views/test/_form.php
Role: Example script
Content type: text/plain
Description: Example script
Class: YII2 Framework PHP Init
Create a project based on the YII2 from template
Author: By
Last change:
Date: 2 years ago
Size: 1,667 bytes
 

Contents

Class file image Download
<?php

use yii\helpers\Html;
use
yii\bootstrap\ActiveForm;
use \
dmstr\bootstrap\Tabs;
use
yii\helpers\StringHelper;

/**
* @var yii\web\View $this
* @var app\models\Test $model
* @var yii\widgets\ActiveForm $form
* @var string $relAttributes relation fields names for disabling
*/

?>

<div class="test-form">

    <?php $form = ActiveForm::begin([
   
'id' => 'Test',
   
'layout' => 'horizontal',
   
'enableClientValidation' => true,
   
'errorSummaryCssClass' => 'error-summary alert alert-error'
   
]
    );
   
?>

    <div class="">
        <?php $this->beginBlock('main'); ?>

        <p>
           
            <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'createdate')->textInput() ?>
<?= $form->field($model, 'update_dt')->textInput() ?>
</p>
        <?php $this->endBlock(); ?>

        <?=
    Tabs
::widget(
                 [
                  
'encodeLabels' => false,
                    
'items' => [ [
   
'label' => Yii::t('app', StringHelper::basename('app\models\Test')),
   
'content' => $this->blocks['main'],
   
'active' => true,
], ]
                 ]
    );
   
?>
<hr/>

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

        <?= Html::submitButton(
       
'<span class="glyphicon glyphicon-check"></span> ' .
        (
$model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save')),
        [
       
'id' => 'save-' . $model->formName(),
       
'class' => 'btn btn-success'
       
]
        );
       
?>

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

    </div>

</div>