=== modified file 'includes/form.inc' --- includes/form.inc 2006-12-12 10:01:38 +0000 +++ includes/form.inc 2006-12-28 21:50:18 +0000 @@ -937,6 +937,30 @@ function form_select_options($element, $ } /** + * Traverses a select element #option seeking for the object that holds the + * given key. Returns FALSE if not found. As usual with functions that can + * return 0 or FALSE do not forget to use === and !== if needed. + * + * @param $element + * The select element + * @param $key + * The key to look for + * @return + * The index of the object that helds the $key with some value. + */ +function form_get_option_key($element, $key) { + foreach ($element['#options'] as $index => $object) { + if (isset($object->option[$key])) { + return $index; + } + } + return FALSE; +} + + + + +/** * Format a group of form items. * * @param $element