当表单选择字段取决于域对象属性的值时该怎么办
What should I do when a form choice field depends on property of
domain object. I have insurance field that should contain insurances
of specific user.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果保险选择是用户的已知值,那么您可以在创建表单时将它们作为选项传递:
然后在表单类中:
然后您可以在
buildForm()
中使用它们请。希望有帮助。If the insurance choices are a known value of the user, then you can pass them in as options when you create your form:
then in your form class:
You can then use them in
buildForm()
as you please. Hope that helps.