4

Is there a way to bring up a help message next to a form field as below?

FooForm.php

$form['field_foo'] = array(
    '#type'          => 'textfield',
    '#title'         => t('Foo'),
    '#required'      => true,
    '#default_value' => 'foo',
    '#help_text' => 'Help text for Foo field',
);
8

Use #description attribute.

$form['field_foo'] = array(
  '#type'          => 'textfield',
  '#title'         => t('Foo'),
  '#required'      => true,
  '#default_value' => 'foo',
  '#description' => t('Help text for Foo field'), 
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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