Symfony1 symfony:一些字段相互关联的表单
我有这个模式。ymlSymfony1 symfony:一些字段相互关联的表单,symfony1,doctrine,symfony-1.4,symfony-forms,Symfony1,Doctrine,Symfony 1.4,Symfony Forms,我有这个模式。yml Region: columns: name: { type: string(255), notnull: true, unique: true } options: symfony: { form: false, filter: false } Province: columns: id: { type: string(2), notnull: true, primary: true } name: { type: string
Region:
columns:
name: { type: string(255), notnull: true, unique: true }
options:
symfony: { form: false, filter: false }
Province:
columns:
id: { type: string(2), notnull: true, primary: true }
name: { type: string(255), notnull: true, unique: true }
region_id: { type: integer, notnull: true }
relations:
Region: { local: region_id, foreign: id, onDelete: CASCADE, foreignAlias: Provinces }
options:
symfony: { form: false, filter: false }
City:
columns:
id: { type: string(4), notnull: true, primary: true }
name: { type: string(255), notnull: true, unique: true }
province_id: { type: string(2), notnull: true }
latitude: { type: decimal, scale: 6, size: 8, notnull: true }
longitude: { type: decimal, scale: 6, size: 8, notnull: true }
relations:
Province: { local: province_id, foreign: id, onDelete: CASCADE, foreignAlias: Cities }
options:
symfony: { form: false, filter: false }
我想制作一个表格,使这些字段相互关联:我在下拉菜单中选择该地区,然后在下一个下拉菜单中,我可以在所选地区的省份之间进行选择,然后在最后一个下拉菜单中,我只能看到先前所选省份的城市
我不知道该怎么做。。。你能帮我吗?你可以使用这个插件,它非常有用
你可以使用这个插件,它非常有用
首先,您需要删除每个模型的
表单:false
,以便生成表单类。好的,非常感谢。。。我已经创建了表单,但即使表有外键,当我在表单中使用这些字段(地区、省、市)时,它们没有我想要的行为……您需要的这种行为并不存在(impov)。你必须自己建造好,非常感谢。你知道symfony的书中有没有解释过如何实现这种行为?你知道一些这样的代码吗?我没有看到这样的行为,对不起,首先,你需要删除form:false
,每个模型才能生成form类。好的,非常感谢。。。我已经创建了表单,但即使表有外键,当我在表单中使用这些字段(地区、省、市)时,它们没有我想要的行为……您需要的这种行为并不存在(impov)。你必须自己建造好,非常感谢。你知道symfony的书中有没有解释过如何实现这种行为?你知道一些这样的代码吗?对不起,我没有看到这样的行为