如何在多个页面中拆分长的symfony形式? [英] how to split long symfony form in multiple pages?

查看:121
本文介绍了如何在多个页面中拆分长的symfony形式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为具有许多属性的实体创建表单.为了确保数据输入的简便性,我想将该表格分为多页(例如2或3页). 让我们以广告实体示例为例:

I want to create a form for an entity which has a many attributes. To ensure the ease of data entry, I want to split that form in multiple pages (for example 2 or 3 pages). Let's take the ad entity example:

  1. 在第1页中,用户将输入广告文字
  2. 在第2页中,用户将输入他的联系人
  3. 在第3页中,用户将提供广告的(X,Y)位置

此拆分将需要在进入下一页之前,在第一页中保存可用数据(插入数据库中).不幸的是,由于限制,这是不可能的.

This split will require saving the available data (inserting in the database) in the 1st page before moving to the next page. Unfortunately, This is not possible due to constraints.

问题是:是否有任何文档或示例可以解决此问题?

The question is: Is any documentations or any examples that solve this issue?

如果没有可用的文档,您认为最好将我的实体拆分为n个实体,以便每页有一个实体?

If no documentation is available, do you think it is better to split my entity in n entities in order to have one entity per page?

感谢您的帮助.

推荐答案

您可能应该使用 CraueFormFlowBundle .它提供了用于构建多步骤表单的工具.

You probably should use CraueFormFlowBundle. It provides facilities for building multi-step forms.

您可以为整个流程创建一种表单类型,也可以为每个步骤创建一种表单类型.

You can create one form type for an entire flow, or one form type per step.

这很容易设置.一切都在此处进行了解释.

It's very easy to setup. Everything is explained here.

这篇关于如何在多个页面中拆分长的symfony形式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆