function _autocomplete_widgets_validate_allowvals in Autocomplete Widgets for Text and Number Fields 7
Validate a list autocomplete element.
1 string reference to '_autocomplete_widgets_validate_allowvals'
- autocomplete_widgets_field_widget_form in ./
autocomplete_widgets.module - Implementation of hook_field_widget_form().
File
- ./
autocomplete_widgets.common.inc, line 325 - Common functions for Autocomplete Widgets module.
Code
function _autocomplete_widgets_validate_allowvals($element, &$form_state) {
$instance = field_widget_instance($element, $form_state);
if ($instance['widget']['type'] == 'autocomplete_widgets_allowvals') {
$label = $element['#value'];
if ($label !== '') {
module_load_include('inc', 'autocomplete_widgets', 'autocomplete_widgets.common');
$options = _autocomplete_widgets_get_options($instance, $label, 'equals', NULL, 1);
if (empty($options)) {
form_error($element, t('%name: %label is not a valid option for this field.', array(
'%name' => $instance['label'],
'%label' => $label,
)));
}
}
}
}