2013-05-22 55 views
0

我已經通過編程方式在Drupal中創建了一個表單。我怎樣才能包裝div的每個元素的形式。下面是我的示例代碼使用包裝創建Drupal表單

function emailusers_compose_form($context, $account) { 

    $form['to'] = array(
    '#type' => 'value', 
    '#value' => $account, 
    ); 

$form['message']['subject'] = array(
'#type' => 'textfield', 
'#title' => t('Subject'), 
'#size' => 50, 
'#maxlengh' => 255, 
'#description' => t('The subject of the email message.'), 
); 


$form['submit'] = array(
'#type' => 'submit', 
'#value' => t('Send Mail'), 
); 
return $form; 
} 

回答

2

這裏是

function emailusers_compose_form($context, $account) { 
    $form['to'] = array(
    '#type' => 'value', 
    '#value' => $account, 
); 

    $form['message']['subject'] = array(
    '#type' => 'textfield', 
    '#title' => t('Subject'), 
    '#size' => 50, 
    '#maxlengh' => 255, 
    '#description' => t('The subject of the email message.'), 
    '#prefix' => '<div id="elementid">', 
    '#suffix' => '</div>' 
); 

    $form['submit'] = array(
    '#type' => 'submit', 
    '#value' => t('Send Mail'), 
); 
    return $form; 
} 
+0

可能希望使用周圍的'elementid'雙引號(「)的答案。 – kekkis

+0

你也可能會覆蓋文本框他們用鉤子主題 – Bdwey