2011-12-20 51 views
1

我這樣做是使用以下功能的te​​mplate.php錯誤消息不在drupal 6中的自定義表單模板中顯示?

function mytheme_theme() { 
    return array(
    'nsa_create_form' => array(
     'arguments' => array('form' => NULL), 
     'template' => 'nsa-create', 
     ), 
    ); 
} 

並補充NSA-create.tpl.php與下面的行代碼

<?php if ($show_messages && $messages): print $messages; endif; ?> 

<?= drupal_render($form['start_date']) ?> 
<?= drupal_render($form['end_date']) ?> 
<?= drupal_render($form['confirm_dates']) ?> 
<?= drupal_render($form['name']) ?> 
<?= drupal_render($form['emp_id']) ?> 
<?= drupal_render($form['client']) ?> 
<?= drupal_render($form['designation']) ?> 
<?= drupal_render($form['manager']) ?> 
<?= drupal_render($form['competency']) ?> 
<?= drupal_render($form['wrapper_nsa']) ?> 
<?= drupal_render($form['submit']) ?> 

其正確渲染,但錯誤/確認消息沒有顯示,無效字段沒有紅色邊框。

+0

IIRC,表單的錯誤消息使用「標準」的Drupal消息通道,即它們會注入到頁面模板,_not到表格template._至於無效字段上的紅色邊框,這些應該在字段元素包裝上以'class =「error」'的形式出現 - 你應該檢查你的渲染邏輯是否包含了包裝div(並且你的CSS正確地對錯誤類作出反應)。 – 2011-12-20 11:46:18

回答

1

請問您有page.tpl.php中

<?php print $messages; ?> 
相關問題