You are here

function _webform_edit_validate_select in Webform 5

Same name and namespace in other branches
  1. 5.2 components/select.inc \_webform_edit_validate_select()
  2. 6.3 components/select.inc \_webform_edit_validate_select()
  3. 6.2 components/select.inc \_webform_edit_validate_select()
  4. 7.4 components/select.inc \_webform_edit_validate_select()
  5. 7.3 components/select.inc \_webform_edit_validate_select()

File

components/select.inc, line 49

Code

function _webform_edit_validate_select($form_values) {
  $rows = explode("\n", _webform_filtervalues($form_values['extra']['items'], FALSE));
  foreach ($rows as $row) {
    $row = trim($row);
    if (preg_match('/^(.+)?\\|(.*)$/', $row, $matches)) {
      if (preg_match('/ |"/', $matches[1])) {
        form_set_error('field][extra][items', t('The options for this select contain illegal characters (quotes or spaces). Specify your options as <em>safe_value_no_spaces</em>|<em>The Real Value</em>.'));
        return false;
      }
    }
  }
  return true;
}