2012-07-19 41 views
0

我想將我的drupal窗體的提交按鈕移動到窗體的頂部位置。默認情況下,它總是出現在每個表單的底部。但我希望它位於頂端位置。移動提交按鈕而不是底部

請幫幫我。

回答

-1

默認情況下它會在bootom上,你可以用CSS設置top:px;

還有另一個解決方案給你的問題,你可以使用Arrange Field模塊,你可以拖放你組成的組件。 希望它會幫助你 enter image description here

2

hook_form_alter是你的朋友在這裏。

在您的主題的template.php文件中,您希望調用YOUR_THEME_NAME_form_alter。

function YOUR_THEME_NAME_form_alter(&$form, &$form_state, $form_id) { 
     if ($form_id == 'YOUR_FORM_ID') { // Targets the specific form.  
     $form['actions']['submit']['#weight'] = 0; // Set this until your button is in the right place. You can include negative integers. 
     } 
} 
0

將按鈕放在任何你想要的地方,只需將它放到窗體的模板文件中即可。

<?php print drupal_render($form['actions']['submit']); ?> 

,並確保在頁面上添加

<?php print drupal_render_children($form) ?> 

某處接近底部了。

0

有一個名爲Content Type Extras的Drupal模塊,可以很容易在編輯頁面的頂部添加另一個「保存」按鈕。它還包含其他額外的按鈕,例如「保存並新建」按鈕和「保存並編輯」按鈕。 祝福, Stephen