Forums

(solved) multi select lists

?
Guest 17 Apr, 2012
hi all,

I have set up a select list with multi select using a custom element:
<?php $database =& JFactory::getDBO(); ?>
<select multiple="multiple" size="5" class="" title="" type="select" name="type_specific">
   <?php $database->setQuery("SELECT * FROM #__cf_sometable ORDER BY `var_name`");
	$vars= $database->loadObjectList();
	foreach ( $vars AS $var ) {
		$option  = $var->var_name;
		$option_id = $var->var_id;
		echo "<option value='" . $option_id . "'>" . $option . "</option>";
	} ?>
</select>


the DBML has var_name added to Array Fields Sets and Array Separators set to comma
the handle arrays action is added b4 the db save and has Delimiter set to comma

prob is that with more than 1 option selected only the last option is being posted

could somebody pls help me out?

J!2.5 CF 4 RC3.21
GreyHead 17 Apr, 2012
Hi gabrielaH,

For a multi-select you need an array name name="type_specific[]"

Bob
?
Guest 17 Apr, 2012
Hi Bob,

*slaps head* and thanks bunches for the prompt help :-)
This topic is locked and no more replies can be posted.