function options_field_widget_validate

Form element validation handler for options element.

1 string reference to 'options_field_widget_validate'
options_field_widget_form in modules/field/modules/options/options.module
Implements hook_field_widget_form().

File

modules/field/modules/options/options.module, line 171

Code

function options_field_widget_validate($element, &$form_state) {
    if ($element['#required'] && $element['#value'] == '_none') {
        form_error($element, t('!name field is required.', array(
            '!name' => $element['#title'],
        )));
    }
    // Transpose selections from field => delta to delta => field, turning
    // multiple selected options into multiple parent elements.
    $items = _options_form_to_storage($element);
    form_set_value($element, $items, $form_state);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.