S
S
Sergey2015-04-27 15:07:33
Yii
Sergey, 2015-04-27 15:07:33

How to disable backend validation for some fields in yii2?

The fact is that I generate some of the fields on the frontend, and they come to the server as an array. And the server, apparently, returns an error, because an array of strings, not a string, as prescribed in the validation rules. How can I turn them off completely or check them differently, like an array of strings or an array of integers and only on the backend? On the frontend, everything is validated perfectly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Makarov, 2015-04-27
@butteff

In no case should you rely on validation only on the frontend. The backend should always duplicate it. If they come as an array, validate as an array. The master already has some stuff on this topic, not yet in the current release. You can try to tighten master, you can do your own validation through methods.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question