Quantcast
Channel: Recent posts across whole site
Viewing all articles
Browse latest Browse all 49197

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

$
0
0

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.png89.61 KB

Viewing all articles
Browse latest Browse all 49197

Trending Articles