I have a textfield attribute that seems to default to 128 characters. I'm using a View to display all the products in a table. 128 characters is too wide to display in the fixed width theme I am using. I really only need it to be 20 or so characters wide. How can I override the default and limit this to 20 characters?

Thanks, Chris

Comments

chrisindallas’s picture

OK, actually it is the size that I need to edit, not maxlength. I went ahead and added a #size line to uc_attribute.module

 $form_attributes[$attribute->aid] = array(
'#type' => 'textfield',
'#title' => $attribute->name,
'#description' => check_markup($attribute->description),
'#default_value' => $attribute->required == FALSE ? $attribute->options[$attribute->default_option]->name : '',
'#required' => $attribute->required,
'#size' => 20,
);

but I don't think this is a final solution.

rszrama’s picture

Status: Active » Closed (won't fix)

Support requests are handled through the Ubercart support forums. You should post there to see if anyone can give you some advice on using hook_form_alter() to modify the form.

ryan88’s picture

You can also alter the size of text fields through CSS, which would be the easiest way if you just wanted to make the width smaller.