Hi All,

I have a webform with a file_upload field on it. I need to reduce the size of the field (the appearance of it) to fit in a fairly small block (at the moment it just breaks out of the end of the block - and It's not appropriate for me to use overflow:hidden in the CSS). I have tried to do a form_alter hook with:

if ($form_id == 'name-of-web-form') {
		//Do stuff to edit form
}

But it never bites, I have been debugging it with Eclipse and it just skips right over the breakpoint even though I have the correct form_id. Does anyone know if it is possible to alter webforms in this fashion?

Cheers

Comments

jeebsuk’s picture

I have accessed the form in the form_alter, but I do not know how to shrink the size of the file_upload field. Please help lol

gogowitsch’s picture

You have to create a modified version of theme_file() in your theme. You can then either control the length via the

feo’s picture

With hook_form_alter You could do it also in Your template.php.

function YOURTHEME_form_alter(&$form) {
  if($form['#node']) {
    switch($form['#node']->type) {
      case 'webform':
        ...
        break;
      default:
        break;
    }
  }
}
lukus’s picture

Probably best to use isset() with the check for $form['#node'] in case the index doesn't exist (e.g. the search block form doesn't include this index).

function YOURTHEME_form_alter(&$form) {
  if(isset($form['#node'])) {
    switch($form['#node']->type) {
      case 'webform':
        ...
        break;
      default:
        break;
    }
  }
}
alejo d’s picture