Drupal 6 Form API - setting #size doesn't seem to set for me?

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by texas-bronius on January 13, 2011 at 5:20pm

For some reason my module's form's textfield is not obeying the size => 4 I'm asking it to be. Am I overlooking something (again)?
In addition to the whole code below, see the attached screenshot...

<?php
function project_calc_concrete_calculator() {
$form['instructions'] = array(
'#prefix' => '<p>',
'#value' => t('Enter concrete slab dimensions'),
'#suffix' => '</p>',
);
$form['concrete'] = array(
'#type' => 'radios',
'#title' => t('Pick desired concrete'),
'#options' => array(
'1' => t('80lb Bag of Concrete'),
'0.6' => t('80lb Bag of Regular Concrete'),
'0.5' => t('40lb Bag of Concrete'),
),
'#required' => true,
);
$form['length'] = array(
'#type' => 'textfield',
'#title' => t('Length'),
'#field_suffix' => t('feet'),
'#required' => true,
'#size' => 4,
'#weight' => 1,
);
$form['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#field_suffix' => t('feet'),
'#required' => true,
'#size' => 4,
'#weight' => 2,
);
$form['depth'] = array(
'#type' => 'textfield',
'#title' => t('Depth'),
'#field_suffix' => t('inches'),
'#required' => true,
'#size' => 4,
'#weight' => 3,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Go',
// '#executes_submit_callback' => false,
'#weight' => 10,
);
$form['msg'] = array(
'#prefix' => '<div id="calc-msg">',
'#value' => t('Enter values, and click Go.'),
'#suffix' => '</div>',
'#weight' => 11,
);
return
$form;
}
?>

results in
<input type="text" class="form-text required" value="" size="" id="edit-length" name="length" maxlength="128">

Thanks
-Bronius

AttachmentSize
drupal-6-fapi-size-empty.png 89.61 KB

Houston Drupal Users Group

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /