drupal表单元素: Textarea(文本域)

 

文本域元素的示例如下:
$form['pet_habits'] = array(
       '#title' => t('Habits'),
       '#type' => 'textarea',
       '#description' => t('Describe the habits of your pet.'),
       '#default_value' => $user->pet_habits,
       '#cols' => 40,
       '#rows' => 3,
       '#resizable' => FALSE,
       '#weight' => 15,
);
       文本域元素的常用属性如下:#attributes, #cols (默认为60) , #default_value, #description, #prefix, #required,#resizable, #suffix, #title, #rows (默认为5) , #process(默认为form_expand_ahah), 和 #weight。
    如果通过设置#resizable为TRUE,启用动态的文本域调整器,那么属性#cols的设置将不起作用。
 

老葛的Drupal培训班 Think in Drupal

Drupal版本: