Posted By

marcelodornelas on 03/11/10


Tagged

form drupal hook


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

marcelodornelas
mbria
Onfire60
zack


Drupal example on how to use form alter hook


 / Published in: PHP
 

URL: http://geeksandgod.com/forums/dynamic-website-forums/all-about-drupal/resize-registration-email-and-name-textfield-drupal-6

Resizing fields using a custom module

You could also resize the field using a custom module. For example, if you created mysite.module, you could use something like this to reduce the field size to 30 characters

  1. function mysite_form_alter(&$form, &$form_state, $form_id)
  2. {
  3. switch ($form_id)
  4. {
  5. case 'user_profile_form':
  6. $form['account']['name']['#size'] = 30;
  7. $form['account']['mail']['#size'] = 30;
  8. break;
  9. }
  10. }

Report this snippet  

You need to login to post a comment.