2012-04-26 30 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

回答