Experimental project
This is a sandbox project, which contains experimental code for developer use only.
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'),
);
?>
Project information
- Project categories: Site structure, Developer tools
- Created by tomotomo on , updated