Home ›
HTML5 placeholder via form alterHTML5 placeholder via form alter
Submitted by Benjamin Melançon on February 2, 2011 - 12:34pm
In a module OR a theme:
<?php
/**
* Use the HTML5 placeholder attribute to add help text to the search box.
*/
function PROJECTNAME_form_search_block_form_alter(&$form, &$form_state) {
$form['search_block_form']['#attributes']['placeholder'] = t('enter search terms');
}
?>
(via http://adaptivethemes.com/html5-placeholder-text-for-your-drupal-7-search-field#comment-1509 )
More like this
- Hands on a Blackberry: Making an HTML5 site work in old Blackberry (hint: remove HTML5 elements)
- HTML5 RDFa = time to get rid of that 20th century furniture | PINGV Creative
- Drupal AJAX caught rendering (parts of) the form rather than just inserting returned HTML
- Add action form print_r dump - for easy reference for form_alter and form theming
- Adding to the content types settings forms with form_alter


Comments
Post new comment