PHP Classes

File: views/test-contacts/_form.php

Recommend this page to a friend!
  Classes of Uldis Nelsons   YII2 Framework PHP Init   views/test-contacts/_form.php   Download  
File: views/test-contacts/_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,950 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\TestContacts $model
* @var yii\widgets\ActiveForm $form
* @var string $relAttributes relation fields names for disabling
*/

?>

<div class="test-contacts-form">

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

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

        <p>
           
            <?= // generated by schmunk42\giiant\generators\crud\providers\RelationProvider::activeField
$form->field($model, 'test_id')->dropDownList(
    \
yii\helpers\ArrayHelper::map(app\models\Test::find()->all(), 'id', 'name'),
    [
       
'prompt' => Yii::t('app', 'Select'),
       
'disabled' => (isset($relAttributes) && isset($relAttributes['test_id'])),
    ]
);
?>
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
</p>
        <?php $this->endBlock(); ?>

        <?=
    Tabs
::widget(
                 [
                  
'encodeLabels' => false,
                    
'items' => [ [
   
'label' => Yii::t('app', StringHelper::basename('app\models\TestContacts')),
   
'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>