form input field is not sizeable
jpulles - January 15, 2008 - 07:26
| Project: | Drupal |
| Version: | 6.x-dev |
| Component: | forms system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Description
A form input field is not sizeable. If I define a field with a textfield form item with a parameter such as '#size' => 10 it still shows as a text field filling (almost) the whole width.
The width:95% settings in node.css for the form-text class appears to be the reason for ignoring the size attribute of a form input field.
It occurs both in the garland and bluemarine themes.
It can also be noticed on the q=node/add/page page where e.g. the author field should have a width of only 60 characters, but occupies the whole width and increases with the size of the browser window.

#1
Those css declarations have been there a very long time (at least since 4.7), so this might well be "by design". Is there are particular reason you can't overwrite this in your theme?
#2
It can be overwritten in a custom theme, but I would expect that the standard css styling should conform to the form api. Could it be that css declarations that have been there a very long time, are not applicable anymore?
#3
Removed the width:95% from the node.css style sheet in the node module so that size assigned to input fields using the Forms API is actually effective.
Seems illogical to be able to assign a size to an input, but have it over-ridden by default.
#4
I think if you take it out of node.css, you should probably put it into Garland, otherwise this would change how the default install looks. Others might disagree though.
#5
Agreed, recommend the patch from #3 and this patch both be applied, so that the default install stays the same, but other themes are not required to override node.css.
#6
boydjd, to get this reviewed and/or applied to core, it'll have to be one patch with both changes. Also, I don't have a strong opinion either way, but it might be worth seeing how this looks in the other core themes, and if they also need the same treatment.
#7
Combined into a single patch.
#8
I'm thinking now that the theme should not specify 95%, as this does not solve the OP's problem. Recommend committing patch in #3 only.
#9
There is a larger problem here in that input size's are hard coded in system_elements(). I think we need a default styling applied after the hard-coded size is removed. I'm closing this as a duplicate of #196821: Input field sizes should be easly resizeable where I'd like to focus the work.