mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-15 06:40:59 +08:00
36 lines
1001 B
Markdown
36 lines
1001 B
Markdown
Complex Forms with Multiple Models
|
|
==================================
|
|
|
|
In complex user interfaces it can happen that a user has to fill in data in one form that
|
|
has to be saved in different tables in the database. The concept of Yii forms allows you to
|
|
build these forms with nearly no more complexity compared to single model forms.
|
|
|
|
Same as with one model you follow the following schema for validation on the server side:
|
|
|
|
1. instantiate model classes
|
|
2. populate the models attributes with input data
|
|
3. validate all models
|
|
4. If validation passes for all models, save them
|
|
5. If validation fails or no data has been submitted, display the form by passing all model instances to the view
|
|
|
|
In the following we show an example for using multiple models in a form... TBD
|
|
|
|
Multiple models example
|
|
---------------
|
|
|
|
> Note: This section is under development.
|
|
>
|
|
> It has no content yet.
|
|
|
|
TBD
|
|
|
|
Dependend models
|
|
----------------
|
|
|
|
|
|
> Note: This section is under development.
|
|
>
|
|
> It has no content yet.
|
|
|
|
TBD
|