First little disappointment with Drupal is that it does not allow HTML5 specific input types. This is how I tried to modify one input box in my contact form replacing attribute type="text"
with type="email"
:
<?php
function f1init_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
case 'contact_mail_page':
//print_r($form);
$form['name']['#type'] = 'email';
break;
}
?>
Unfortunately, result is bad. The object completely disappears from the page. Little investigation lands me in
~/includes/form.inc
. Basically, there is now no way to override type=""
. Even less encouraging is the fact that Drupal 7 has the same issue, I am hopeful that will be fixed though; in the meantime, I will try to think of a solution.