By tmj2k7 on
Why isn't the form text field respecting the length I set?
$form['value'] = array(
'#type' => 'textfield',
'#title' => t('Value'),
'#size' => 3,
'#maxlength' => 3,
'#required' => TRUE,
'#description' => t('1-100'), );Yet when I display that the field extends the width of the form...not just 3 characters.
Comments
in addition
how would I get several such fields (when sized 3 properly) to display side by side so it doesnt extend all the way down the page?
www.thelinuxuser.com
This might help
Check out: http://drupal.org/node/41936
Icky. That feature isn't
Icky. That feature isn't worth me hacking around forms.inc right now. I would like the field sized properly however.
www.thelinuxuser.com
Sorry, I can't duplicate it on my machine
It works fine on my machine, so I'm sorry but I don't know anything to suggest.
issue with Themes
I have noticed that some Themes will override your size for textfields and other fields that allow a size and throw it to 100% of the size of the window.
Try using another theme and see if you have the same problem. I know when using spreadfirefox on one of my sites this is what happens, and if I go back to another theme the fields are displayed correctly.
my theme is custom from
my theme is custom from scratch. let me find the css selector for textfields and see if I can override it.
www.thelinuxuser.com
its gotta be a theme/div/css
its gotta be a theme/div/css thing. cut n past of the underlying html unstyled and its fine.
www.thelinuxuser.com
found it! Inside drupal.css
found it! Inside drupal.css (4.7 build)
drupal.css
this was bugging me for a while now, hope it helps others building custom forms.