drupal 6 中的自定义表单模板中未显示错误消息?

发布于 2024-12-22 05:10:18 字数 946 浏览 6 评论 0原文

我在 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']) ?>

其正确呈现,但不显示错误/验证消息,并且无效字段没有红色边框。

I did this using below function in template.php

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

And added nsa-create.tpl.php with the below lines of code

<?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']) ?>

its rendered properly but error/validation messages are not displayed and no red border for invalid fields.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伪心 2024-12-29 05:10:18

你的page.tpl.php有吗

<?php print $messages; ?>

does your page.tpl.php have

<?php print $messages; ?>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文