[development] how to setup a default value in select object?

Aldo Martinez Selleras aldo at caonao.cu
Thu Dec 18 17:11:50 UTC 2008


i'am creating a select object with drupal form api, and i want ti setup a 
defautl value from the array of options

	$net = drupal_map_assoc(array('Dial-up', 'Cable/dsl', 'Lan'));
	$form['meet_net'] = array(
		'#type' => 'select',
		'#options' => $net,
		'#title' => t('Network'),
		'#default_value' => $net['Lan'],
	);

i can do this with that variant, but i need to user numeric values from the 
array, by example

'#default_value' => $net[2],

for save data in database??

how can i do that them??

-- 
----------------------
Aldo Martinez Selleras
Administrador del Nodo
CITMATEL GND Camaguey
Tel: 32-291661
E-mail: aldo at caonao.cu
Linux User #364356


More information about the development mailing list