Hi there,

Im totally new to drupal. Iv set up a small site and was wondering if it is possible to add an HTML placeholder with a value to the following code.

$form['mail'] = array(
'#type' => 'textfield',
'#title' => t('Your e-mail address'),
'#maxlength' => 255,
'#default_value' => $user->uid ? $user->mail : '',
'#required' => TRUE,

So you would get something like this I guess.

$form['mail'] = array(
'#type' => 'textfield',
'#title' => t('Your e-mail address'),
'#placeholder' => t('wow it works'),
'#maxlength' => 255,
'#default_value' => $user->uid ? $user->mail : '',
'#required' => TRUE,

This does not work. If any one has got some ideas let me know. Iv been looking on forums for hours and can't find anything about it.

Cheers,
AJCvHall

Comments

ajcvhall’s picture

Ow yeah the document can be found under Modules > block > contact >contact.pages.inc

nevets’s picture

There is no core support for #placeholdder but it can be added with the Elements module.

ajcvhall’s picture

OK thnx, Ill check it out! Cheers

ajcvhall’s picture

Default it gives the field your name a placeholder but the rest of the input fields non. Their is hardly any documentation.

www.original-concepts.eu/contact

Would you maybe have any suggestions ?

cheers!