Hi,
Upon customizing the search form for a site that I am developing, I have noticed that the size=x attribute of the select tag in forms.inc is ignored.
In forms.inc, the select tag omits the $element['#extra'] in the construction thereof.
Attached is a patch that (hopefully) addresses this issue properly. For some reason I can't attach files, so I have pasted the code here [1]. Not sure if it will apply as pasted here, but the diff file I created applied on my test site.
This patch is for Drupal cvs downloaded approximately 21 December 2005. I searched for a bug report for this, but couldn't find it, so I assume this hasn't been noticed/reported/fixed yet.
Regards,
Kobus
[1]
--- form.inc 2005-12-15 03:00:12.000000000 +0200
+++ form2.inc 2005-12-26 11:33:02.000000000 +0200
@@ -1,5 +1,5 @@
<?php
-// $Id: form.inc,v 1.32 2005-12-14 20:06:41 dries Exp $
+// $Id: form.inc,v 1.32 MOD 2005-12-26 20:06:41 kobus Exp $
/**
* @defgroup form Form generation
@@ -426,7 +426,7 @@
$select .= '<option value="'. $key .'"'. (is_array($element['#value']) ? (in_array($key, $element['#value']) ? ' selected="selected"' : '') : ($element['#value'] == $key ? ' selected="selected"' : '')) .'>'. check_plain($choice) .'</option>';
}
}
- return theme('form_element', $element['#title'], '<select name="'. $element['#name'] .''. ($element['#multiple'] ? '[]' : '') .'"'. ($element['#multiple'] ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="' . $element['#id'] .'">'. $select .'</select>', $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
+ return theme('form_element', $element['#title'], '<select name="'. $element['#name'] .''. ($element['#multiple'] ? '[]' : '') .'"'. ($element['#extra'] ? $element['#extra'] : '') . ($element['#multiple'] ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="' . $element['#id'] .'">'. $select .'</select>', $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
}
/**
Comments
Comment #1
Kobus CreditAttribution: Kobus commentedHi,
I see the file was attached afterall. There was no "Attach..." button. This is not a browser issue, as I have used both FireFox and IE to try to submit the patch. Regardless, it is irrelevant to this post, so if my hunch that it is a bug in Drupal site, I will file a bug report.
Regards,
Kobus
Comment #2
Kobus CreditAttribution: Kobus commentedStill no-one else to confirm whether this patch works or not?
Kobus
Comment #3
Steven CreditAttribution: Steven commentedThis has already been fixed in core it seems. Select now has #size:
Comment #4
Kobus CreditAttribution: Kobus commentedThanks, Steven!
Kobus