Is it possible to order the multilist selection field by alphabetical order when you are creating a new flexinode?

For instace, could i have my HTML form that is structured like this:

value, name
1, dog
2, cat
3, pig
4, horse
5, turtle
6, hamster

be ordered like:

value, name
2, cat
1, dog
6, hamster
4, horse
3, pig
5, turtle

Any help would be awesome. Thank you.

Comments

slayerment’s picture

Anybody?

dtj’s picture

I changed the code in modules/flexinode/contrib/field_multiselect.inc to the following:

function flexinode_field_multiselect_form($field, &$node) {
  $fieldname = 'flexinode_'. $field->field_id;
  $options = array(0 => '<'. t('none') .'>');
  foreach ($field->options as $option) {
    $options[] = $option;
  }
  if ($field->required) {
    unset($options[0]);
  }
  asort($options);
  return form_select(t($field->label), $fieldname, $node->$fieldname, $options, t($field->description), 0, TRUE, $field->required);
}

This alphabatizes the multiselect field when content is added. However, it doesn't alphabatize the options when you're editing the content type itself via "content types".

Note: if the field isn't "required" then "<none>" may sink in the list if you've got options that begin with numeric values.