Placeholder HTML5
Component ID
1290156
Component name
Placeholder HTML5
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
This module does what I thought the Placeholder module (http://drupal.org/project/placeholder) did. With FAPI, you can set '#placeholder' in form elements to have them appear as HTML placeholder attributes.
"Placeholder text is displayed inside the input field as long as the field is empty and not focused. As soon as you click on (or tab to) the input field, the placeholder text disappears." (http://diveintohtml5.org/forms.html)
Other Javascript solutions fill the field with '#default_value' which is not necessarily the same as placeholder text, and will be submitted as the form element's value, unlike HTML5 placeholders.
Using this module is really simple. In your form code, just add a '#placeholder' in any form element.
Example:
<?php
$form['name'] => array(
'#type' => 'textfield',
'#required' => TRUE,
'#placeholder' => t('Enter your name here'),
);
?>
