0

I want to build a form that can use the information stored in a session to set default field values. ie when a user wants to log in, the field username will be populated automatically with the username stored in the session.

4

1 回答 1

1

您可能需要做的是创建自定义表单字段类型,甚至在自定义字段类型中使用转换器

我对 Symfony2 的所有功能都不是非常熟悉,但我假设您可以将会话或响应对象(以获取 cookie)传递给转换器。如果用户名可用,则可以将其设置为字段数据,如果未设置为空字符串。

于 2013-05-08T05:39:09.907 回答