You are here

function _webform_edit_validate_options in Webform 6.3

Same name and namespace in other branches
  1. 7.4 components/select.inc \_webform_edit_validate_options()
  2. 7.3 components/select.inc \_webform_edit_validate_options()

Set the appropriate webform values when using the options element module.

2 string references to '_webform_edit_validate_options'
_webform_edit_grid in components/grid.inc
Implements _webform_edit_component().
_webform_edit_select in components/select.inc
Implements _webform_edit_component().

File

components/select.inc, line 244
Webform module multiple select component.

Code

function _webform_edit_validate_options($element, &$form_state) {
  $key = end($element['#parents']);
  $element_options = $form_state['values'][$key]['options'];
  unset($form_state['values'][$key]);
  $form_state['values']['extra'][$key] = form_options_to_text($element_options['options'], 'custom');

  // Options saved for select components.
  if ($key == 'items') {
    $form_state['values']['extra']['multiple'] = $element_options['multiple'];
    $form_state['values']['extra']['custom_keys'] = $element_options['custom_keys'];
    $form_state['values']['value'] = is_array($element_options['default_value']) ? implode(', ', $element_options['default_value']) : $element_options['default_value'];

    // Set the listbox option if needed.
    _webform_edit_validate_set_aslist($element_options['options'], $form_state);
  }
  else {
    $form_state['values']['extra']['custom_' . rtrim($key, 's') . '_keys'] = $element_options['custom_keys'];
  }
}