A
A
Alexander Laikov2017-02-21 23:57:14
Yii
Alexander Laikov, 2017-02-21 23:57:14

At creation textInput attributes are automatically appropriated. How to fix?

Good afternoon.
Automatically assigns attributes to a text input field.
I pass two values ​​id, form through the controller

public function actionBlock() {
        $form = new BlockForm;
        $id = Yii::$app->request->get();

        return $this->render('block', [
                'form' => $form,
                'id' => $id,
            ]);
    }

in view
$f = ActiveForm::begin();

                    $f->field($form, 'reason', [
                    'template' => '
                        <div class="form-group has-feedback">
                            <label>Почтовый адрес</label>
                            {input}
                            <i class="icon-users form-control-feedback"></i>
                            {error}
                        </div>'
                ])->textInput([
                    'class' => 'form-control',
                    'placeholder' => 'Почтовый адрес'
                ])->label(false); 
ActiveForm::end();

I have a hidden text field in the output
<input type="hidden" name="_csrf" value="VEFEVVpvMHkHJ3VkFzV6Kzt4cTwgP0lLEhEoZT47ckx5dSgmCRhKCQ==">

What is causing all this assignment?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-02-22
@Florens

Good evening.
This field is added for security reasons. Don't worry, everything is fine, as it should be. The form without this will not go to the server.
What is csrf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question