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

catch - January 15, 2008 - 11:38

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

jpulles - January 16, 2008 - 19:51

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

boydjd - January 17, 2008 - 02:32
Status:active» needs review

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.

AttachmentSize
node-form-input.patch 439 bytes

#4

catch - January 17, 2008 - 09:53

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

boydjd - January 17, 2008 - 16:47

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.

AttachmentSize
garland-node-form-input.patch 441 bytes

#6

catch - January 17, 2008 - 18:42
Status:needs review» needs work

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

boydjd - January 17, 2008 - 18:45
Status:needs work» needs review

Combined into a single patch.

AttachmentSize
node-form-input.patch 954 bytes

#8

boydjd - January 17, 2008 - 18:51

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

coltrane - August 29, 2008 - 18:04
Status:needs review» duplicate

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.

 
 

Drupal is a registered trademark of Dries Buytaert.