0
最初我通過多個複選框插入多個ID。現在我想再次打開該頁面進行編輯,但我希望根據我插入的密碼來檢查一些複選框。如何編輯Drupal 7中的複選框值
$ courses包含我需要desplay的所有節點,$ checkarray是來自數據庫 [在提交後插入的ID]的節點。 這裏是uderstand工作的代碼..
$vocabulary = taxonomy_vocabulary_machine_name_load('xxx list');
$terms = taxonomy_get_tree($vocabulary->vid);
$courses = array();
foreach($terms as $term) {
if($term->parents[0]==0){
$courses[$term->tid] = $term->name."<br />";
}
else{
$parents = taxonomy_get_parents($term->tid);
$parentsName = $parents[$term->parents[0]]->name.'/';
$courses[$term->tid] = $parentsName.$term->name."<br />";
}
}
$form['addlicense']['categories'] = array(
'#type' => 'checkboxes',
'#title' => t('Series'),
'#options' => $courses,
'#attributes' => array('class' => array('series-list')),
'#required' => TRUE,
);
$ checkedarray =陣列(5,6,7,8,9,10); 現在我有需要被檢查的複選框,這是$ checkarray陣列中的節點列表...任何幫助,應該讚賞
我使用#default_value後發佈的問題,它爲我工作... BTW感謝answere @claudiu。 – santosh 2014-12-05 05:45:10