P
P
Pavel Tereshchenko2017-08-18 23:05:04
Yii
Pavel Tereshchenko, 2017-08-18 23:05:04

Yii2 + vue js. Automatic generation of form validation rules on the client side. Have you found the best way for you?

Let's say the server part of the application is written in Yii2, let's say VueJS is used on the client.
There is a desire to make the server part in the form of a REST API, and use Vue JS to the fullest on the client.
For now, it stops duplicating rules code for form/model validation on the client and server parts.
We all know that Yii generates form validation rules which are then connected on the client side.
I really don't want to duplicate the form validation rules on the client side.
Please suggest the best solution you use for translating Yii form/model validation rules to the client side.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vksee, 2017-08-19
@vksee

Use the data from $model-> getActiveValidators() to generate rules for your Vue.js validation system.
www.yiiframework.com/doc-2.0/yii-base-model.html#g...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question