function list_allowed_values_setting_validate

cis7 list.module list_allowed_values_setting_validate($element, &$form_state)
cle7 list.module list_allowed_values_setting_validate($element, &$form_state)
elmsmedia7 list.module list_allowed_values_setting_validate($element, &$form_state)
icor7 list.module list_allowed_values_setting_validate($element, &$form_state)
meedjum_blog7 list.module list_allowed_values_setting_validate($element, &$form_state)
mooc7 list.module list_allowed_values_setting_validate($element, &$form_state)

Element validate callback; check that the entered values are valid.

2 string references to 'list_allowed_values_setting_validate'
list_field_settings_form in modules/field/modules/list/list.module
Implements hook_field_settings_form().
options_element_field_settings_after_build in sites/all/modules/ulmus/options_element/options_element.module
Element #after_build callback for the options list in Field UI.


modules/field/modules/list/list.module, line 160
Defines list field types that can be used with the Options module.


function list_allowed_values_setting_validate($element, &$form_state) {
  $field = $element['#field'];
  $has_data = $element['#field_has_data'];
  $field_type = $field['type'];
  $generate_keys = ($field_type == 'list_integer' || $field_type == 'list_float') && !$has_data;

  $values = list_extract_allowed_values($element['#value'], $field['type'], $generate_keys);

  if (!is_array($values)) {
    form_error($element, t('Allowed values list: invalid input.'));
  else {
    // Check that keys are valid for the field type.
    foreach ($values as $key => $value) {
      if ($field_type == 'list_integer' && !preg_match('/^-?\d+$/', $key)) {
        form_error($element, t('Allowed values list: keys must be integers.'));
      if ($field_type == 'list_float' && !is_numeric($key)) {
        form_error($element, t('Allowed values list: each key must be a valid integer or decimal.'));
      elseif ($field_type == 'list_text' && drupal_strlen($key) > 255) {
        form_error($element, t('Allowed values list: each key must be a string at most 255 characters long.'));

    // Prevent removing values currently in use.
    if ($has_data) {
      $lost_keys = array_diff(array_keys($field['settings']['allowed_values']), array_keys($values));
      if (_list_values_in_use($field, $lost_keys)) {
        form_error($element, t('Allowed values list: some values are being removed while currently in use.'));

    form_set_value($element, $values, $form_state);



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.