2012-04-26 51 views
0

我有这个的schema.ymlsymfony的:有一些字段的形式彼此相关

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 } 

我想就已经得到了这些领域彼此相关的一种形式:我选择的区域在下拉菜单,然后在下一个下拉菜单中,我可以选择所选区域的省份,然后在最后一个下拉菜单中,我只能看到之前选择的省份的城市。

我不知道如何做到这一点...你能帮我吗?

+0

首先,你将需要删除'形式:FALSE'每个模型有生成表单类。 – j0k 2012-04-26 19:16:35

+0

好,完美谢谢...我创建了表单,但即使表有外键,当我使用这些字段(地区,省份,城市)的形式,他们没有我想要的行为.. – satboy78 2012-04-26 19:39:41

+0

您需要的这种行为不存在(impov)。你必须建立你自己的 – j0k 2012-04-26 19:41:56

回答