0
也許是有點混亂的問題,但這裏是代碼的解釋:選擇,如選擇字段中鍵入Symfony2中選擇選項
是有沒有辦法做這樣的事情?
$builder->add(
'doYouWantToEnterData',
'choice',
array(
'choices' => array(
0 => 'no',
1 => 'choices_name',
),
),
'extend' =>true
)
->add(
'choices_name',
'choice',
array(
'choices' => array(
0 => 'text_input_name',
1 => 'select_box_name',
),
),
'extend' =>true
)
->add('text_input_name')
->add(
'select_box_name',
'choice',
array(
'choices' => array(
0 => 'choice_1',
1 => 'choice_2',
),
),
);
,你可以看到choices_name是在一個名爲doYouWantToEnterData和選項在choices_name是text_input_name和select_box_name選項選項
是有在FormType類中創建這種東西的方法?
:)
tnx,我會檢查這個... – Nenad