1
我这样做是使用以下功能的template.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']) ?>
其正确渲染,但错误/确认消息没有显示,无效字段没有红色边框。
IIRC,表单的错误消息使用“标准”的Drupal消息通道,即它们会注入到页面模板,_not到表格template._至于无效字段上的红色边框,这些应该在字段元素包装上以'class =“error”'的形式出现 - 你应该检查你的渲染逻辑是否包含了包装div(并且你的CSS正确地对错误类作出反应)。 – 2011-12-20 11:46:18