I have create one form which have two fields.

$form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#maxlength' => 20,

    '#required' => TRUE,

$form['phone'] = array(
    '#type' => 'textfield',
    '#title' => t('Phone'),
    '#maxlength' => 20,
    '#required' => TRUE,

In page.tpl.php file displayed both fields. Now i have press submit button without enter any value in text box error message will displayed.

But in my page.tpl.php file cant display error message!

How can i show all error message?

1 Answer 1


Hope this will help you.

In Drupal 7, just add this line in your custom template file

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

  • @user19815 if that is the correct answer, then accept it.
    – 4life
    Commented Aug 9, 2013 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.