Yii 中单个表单的多部分表单
假设在 Yii Framework 中我有这样的模型属性,
field_1
field_2
field_3
field_4
field_5
field_6
field_7
field_8
field_9
field_10
现在当我保存该模型的表单时,所有属性都会进行验证并保存在一个表单中。但我希望所有模型都进行验证并部分保存。就像这样,
field_1
field_2
field_3
field_4
这些应该以单一形式出现,并且应该验证并保存在数据库中。之后,
field_5
field_6
field_7
field_8
这些也应该以单一形式出现,并且应该验证和 保存保存在数据库中。
field_9
field_10
最后,这也应该以单一形式出现,并且应该验证并保存在数据库中。那么如何做到这一点。我搜索了整个 yii 文档,但没有得到任何好的结果。任何帮助和建议将非常有用。
Suppose in Yii Framework I have the attributes for the model like this
field_1
field_2
field_3
field_4
field_5
field_6
field_7
field_8
field_9
field_10
Now as I am saving the form of this models then all the attributes are doing validation and save in a single form. But I want all the models to make validation and save part by part.Just like this
field_1
field_2
field_3
field_4
These should come in a single form and should be validate and save in the database.After that
field_5
field_6
field_7
field_8
These should also come in a single form and should be validate and save in the database.After that
field_9
field_10
At the end this should also come in a single form and should be validate and save in the database.So how to do that.I searched the total yii documentation but not got any good result.Any help and suggestions will be highly appriciable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这也可以通过场景来解决。在 Yii 文档中查找它们。
This can also be solved by using scenarios. Look them up in the Yii documentation.