Skip to main content

Drupal 7 notes: html5 placeholder text

Posted on: Friday, 25 May 2012 @ 2:03pm
Blatting about
More specifically

<p>Fairly straightforward. Mostly here as a reminder for how to do <a href="http://drupal.org/project/webform">webforms</a&gt; (example has a theoretical nid of 1 and a theoretical form field called "message" and the "submitted" part stymied me for a bit).</p>

<h3>template.php</h3>
<blockquote><?php function mytheme_form_webform_client_form_1_alter(&$form, &$form_state, $form_id) {
$form['submitted']['message']['#attributes']['placeholder'] = t('Type your message here...');
} ?></blockquote>

Could also use a switch in <code>hook_form_alter()</code>. One of these days I'll think about finding out if there's any difference performance-wise in using a big switch with many form alterations or several smaller <code>hook_form_form_id_alters</code>.

No comments yet

KLCtheBookWorm Wednesday, 4 July 2012 @ 8:19am [Permalink]
Hey Bek, I sent you an email with a Drupal question.  Are you not using the Gmail addy any more?
bek Wednesday, 4 July 2012 @ 10:11am [Permalink]
KLCtheBookWorm Wednesday, 4 July 2012 @ 10:26am [Permalink]
<p>I think I sent it the Saturday before last (can't figure out where Thunderbird is storing my sent emails to double check).</p><p>Short version: can you set up test sites using the same Drupal database or will it complete FUBAR the public site?  Setting up a home server has not been a fun project and keeps going wrong.  Downloading copies of the databases also always goes wrong.  So my idea was to put the sandbox sites online in their own subdomains.</p>
bek Wednesday, 4 July 2012 @ 12:20pm [Permalink]
KLCtheBookWorm Wednesday, 4 July 2012 @ 10:52pm [Permalink]
How many I've got isn't an issue.  Apparantly I pay for an infinite set of both subdomains and databases.  Hopefully, if I copy a database on the same server, it won't give me crap about too big to download or upload.  Thanks.

Add new comment

The content of this field is kept private and will not be shown publicly.