Drupal 6 module 'Placeholder HTML5'
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 page: http://drupal.org/sandbox/tomotomo/1290156
Git: git clone --branch master tomotomo@git.drupal.org:sandbox/tomotomo/1290156.git placeholder_html5
Comments
Comment #1
Everett Zufelt commentedHave you looked at the HTML5 Tools module to see if this feature exists, or if it can be added?
Comment #2
dave reidThis is also supported by the Elements module (http://drupal.org/project/elements)
Comment #3
jthorson commentedIt appears that there have been multiple project applications opened under your username:
Placeholder HTML5: http://drupal.org/node/1290180
Views Substitution Arguments: http://drupal.org/node/1346828
As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue.
With this in mind, I have marked your secondary applications as 'closed(duplicate)', and left one application open (chosen at random).
If you prefer that we proceed through this review process with a different application than the one I that I have left open, then please feel free to close the 'open' application as a duplicate, and re-open one of the other project applications which I had closed.
Thanks in advance for your patience and understanding!
Comment #3.0
jthorson commentedgit and project link
Comment #4
avpaderno