2013-02-27 42 views
1

table output with code shown hereDrupal的6形式表間距發出

我寫了一個窗體模塊,我想使文本框的表,但其間隔爲彼此相隔那麼遠如圖片所示。我怎樣才能讓他們靠得更近?由於某些原因,行與列之間的距離很遠。我希望它們與大多數爲網站構建的HTML表格一樣緊挨着。

其次,有沒有辦法將表單合併到由常規文本內容的Drupal提供的theme_table()中?這些格式對於這些人來說非常好。 - >http://coffeeshopped.com/2010/09/drupal-drag-and-drop-tables-in-custom-modules 我應該能夠將$表單填充到theme_table()的$ header和$ row數組中。 我張貼這種替代,這也是這裏的一個問題:drupal 6 form module not calling hook_theme

$form['a1'] = array(
    '#type' => 'textfield', 
    '#title' => t('Date'), 
    '#prefix'=>'<table><tr><td>', 
    '#suffix'=>'</td>', 
); 
    $form['a2'] = array(
    '#type' => 'textfield', 
    '#title' => t('Amount Requested'), 
    '#prefix'=>'<td>', 
    '#suffix'=>'</td>', 
); 
    $form['a3'] = array(
    '#type' => 'textfield', 
    '#title' => t('Amount Recieved'), 
    '#prefix'=>'<td>', 
    '#suffix'=>'</td></tr>', 
); 

    $form['b1'] = array(
    '#type' => 'textfield', 
    '#prefix'=>'<tr><td>', 
    '#suffix'=>'</td>', 
); 
    $form['b2'] = array(
    '#type' => 'textfield', 
    '#prefix'=>'<td>', 
    '#suffix'=>'</td>', 
); 
     $form['b3'] = array(
    '#type' => 'textfield', 
    '#prefix'=>'<td>', 
    '#suffix'=>'</td></tr>', 
); 
    $form['c1'] = array(
    '#type' => 'textfield', 
    '#prefix'=>'<tr><td>', 
    '#suffix'=>'</td>', 
); 
    $form['c2'] = array(
    '#type' => 'textfield', 
    '#prefix'=>'<td>', 
    '#suffix'=>'</td>', 
); 
    $form['c3'] = array(
    '#type' => 'textfield', 
    '#prefix'=>'<td>', 
    '#suffix'=>'</td></tr></table>', 
); 
+0

你好,雖然我不會再複製你的代碼,編輯,測試和職位,但我爲此採取的解決辦法是... – RajeevK 2013-02-27 11:59:28

回答

0

雖然我不會再&後複製你的代碼,編輯,測試,但我對這個採取的解決辦法是像 -

把一些ID或者類中的前綴後綴的形式元素的&風格的他們,或者你只是把一個類/ ID的形式&結束它的第一要素,最後&寫的風格TD/TR這個特別是DIV ..

您將可以通過這種方式修復間距..

可以有其他方式......但這是我的方式。

感謝,

+0

怎麼樣的主題化?我要瘋了試圖找出如何正確地做到這一點:http://stackoverflow.com/questions/15105655/drupal-6-form-module-not-calling-hook-theme – ingrid 2013-02-27 15:32:00

+0

我在哪裏把類? – ingrid 2013-02-27 15:38:50

+0

當您構建表單時,您正在使用​​來創建輸入字段的表。而不是你可以開始

in prefix & end
在後綴...這將做...或者你可以簡單地插入一個空的字段在窗體的開頭,前綴
and end the
在窗體的結尾...你會得到這個表div id ...你可以寫你的CSS ... – RajeevK 2013-02-28 05:11:14