E
E
Express7772016-02-15 18:28:12
Yii
Express777, 2016-02-15 18:28:12

Is it mandatory to use ActiveForm to create forms in YII2?

Hello.
Now I am transferring one project to YII2. Haven't worked with him before.
And here a question arose when creating a login form.
In the documentation, ActiveForm is used to create a login form.
Is this the only way to create a form in Yii2 so that the validation rules work correctly?

public function rules()
{
    return [
        // the name, email, subject and body attributes are required
        [['name', 'email', 'subject', 'body'], 'required'],

        // the email attribute should be a valid email address
        ['email', 'email'],
    ];
}

UPD: See the answer in the comments

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
Y
Yuri, 2016-02-15
@Express777

It is important to understand that the framework - simplifies the work. If you want - no one forbids you to mark up your form, add JS validation (using any libraries), process it on the server, etc. Question: what is it for?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question