【发布时间】:2011-12-20 09:16:46
【问题描述】:
我在 template.php 中使用下面的函数来做到这一点
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 消息通道,即它们被注入到页面模板中,没有注入到表单模板中。 至于红色无效字段的边框,这些应该在字段元素包装器上以
class="error"的形式出现 - 您应该检查您的渲染逻辑是否包含包装 div(以及您的 CSS 是否正确响应错误类)。
标签: drupal drupal-6 drupal-modules drupal-theming