Posted by zythar on March 9, 2010 at 10:53pm
<?php
// some code here
$arr = array( "Nums" => array('va1', 'va2'));
$form['number'] = array(
'#type' => 'select',
'#default_value' => $art_info->number,
'#title' => t("Numbers"),
'#options' => array($arr),
'#required' => true
);
// more code here
?>this is a peace of my implementation of hook_form.
in my drop-down select-box i have the optgroup Nums which i need.
but also i have emty optgroup 0, that i dont need.
how can i make drupal (or maybe theme) understand it?
Comments
Hi, I think you should have
Hi,
I think you should have something like this:
$arr = array( "Nums" => array('va1', 'va2'));
$form['number'] = array(
'#type' => 'select',
'#default_value' => $art_info->number,
'#title' => t("Numbers"),
'#options' => $arr, //not array($arr)
'#required' => true
);
Vasi.