After saving, each Product and Parcel field will be validated individually, if any fail the error will be displayed at the top as well as on the errored field.
Before getting into the code, let’s take a minute to think about the MVC architecture.
A form itself is found in the View, as a form is part of the user interface.
While you are going to be validating on the server anyway, but if it’s a particularly large page, you might want to avoid the page reload.
model related, which represents a parcel that belongs to the product.
Also understand that the same _file is intended to be used whether the form is for creating new records or updating existing ones.
Naturally, the Controller dictates which primary View file gets rendered.Yii2.0 is giving the support for this data validation and also it is very easy way to test the input data.To check validate() of input data, we should declare validation rules for the attributes you plan to validate.compare Value : A constant value , it should be compared with input value. Yii2 was updated lately to support more elegant way of handling Java Script events.We can create custom new rule based on our business criteria.