function _webform_edit_validate_grid in Webform 5
Same name and namespace in other branches
- 5.2 components/grid.inc \_webform_edit_validate_grid()
- 6.2 components/grid.inc \_webform_edit_validate_grid()
File
- components/
grid.inc, line 47
Code
function _webform_edit_validate_grid($form_values) {
$rows = explode("\n", _webform_filtervalues($form_values['extra']['options'], FALSE));
foreach ($rows as $row) {
$row = trim($row);
if (preg_match('/^(.+)?\\|(.*)$/', $row, $matches)) {
if (preg_match('/ |"/', $matches[1])) {
form_set_error('field][extra][options', t('The options for this grid contain illegal characters (quotes or spaces). Specify your options as <em>safe_value_no_spaces</em>|<em>The Real Value</em>.'));
return FALSE;
}
}
}
$rows = explode("\n", _webform_filtervalues($form_values['extra']['questions'], FALSE));
foreach ($rows as $row) {
$row = trim($row);
if (preg_match('/^(.+)?\\|(.*)$/', $row, $matches)) {
if (preg_match('/ |"/', $matches[1])) {
form_set_error('field][extra][questions', t('The questions for this grid contain illegal characters (quotes or spaces).'));
return FALSE;
}
}
}
return true;
}