#958 - Активировать формы обратной связи на сайте.

parent 70281151
......@@ -67,7 +67,13 @@ class Bid extends \common\components\ActiveRecordModel
public function rules()
{
return [
[['name', 'phone', 'email'], 'required', 'on' => self::SCENARIO_PROJECT],
['phone', 'required', 'when' => function($model) {
return !$model->email;
}, 'on' => self::SCENARIO_PROJECT],
['email', 'required', 'when' => function($model) {
return !$model->phone;
}, 'on' => self::SCENARIO_PROJECT],
[['email'], 'email'],
[['name', 'phone'], 'required', 'on' => self::SCENARIO_CALLBACK],
......
......@@ -18,25 +18,29 @@ use common\modules\bids\models\Bid;
<?php
$model = new Bid;
$model->scenario = Bid::SCENARIO_PROJECT;
$model->form = Bid::FORM_PROJECT;
$form = ActiveForm::begin([
'id' => 'form_foot',
'action' => '/',
'enableClientValidation' => false,
'options' => [
'class' => 'footer_form bids-form',
'enctype' => 'multipart/form-data'
'data-title' => 'Рассчитать проект',
'data-form' => 'Рассчитать проект',
'data-tag' => Bid::TAG_TREATMENT
],
]); ?>
<?php echo Html::hiddenInput('scenario', $model->scenario, ['class' => 'not_clear']); ?>
<?php echo Html::hiddenInput('Bid[form]', Bid::FORM_PROJECT, ['class' => 'not_clear']); ?>
<?php echo $form->field($model, 'form', ['template' => '{input}'])->hiddenInput(['class' => 'not_clear']); ?>
<?php echo $form->field($model, 'name', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'Ваше имя*',
'placeholder' => 'Ваше имя',
'class' => 'footer_form__input'
]); ?>
......@@ -44,7 +48,7 @@ use common\modules\bids\models\Bid;
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'Телефон*',
'placeholder' => 'Телефон',
'class' => 'footer_form__input'
]); ?>
......
......@@ -104,7 +104,7 @@ use \common\modules\bids\models\Bid;
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'Ваше имя*',
'placeholder' => 'Ваше имя',
'class' => 'sect_cont_form__input'
]); ?>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment