function wsclient_ui_validate_parameters in Web service client 7
FAPI callback to validate the form for editing parameter info.
2 string references to 'wsclient_ui_validate_parameters'
- wsclient_ui_operation in wsclient_ui/
wsclient_ui.inc - Operation form.
- wsclient_ui_type in wsclient_ui/
wsclient_ui.inc - Data type form.
File
- wsclient_ui/
wsclient_ui.inc, line 1104 - WSClient UI - implements service description management and configuration screens.
Code
function wsclient_ui_validate_parameters($elements, &$form_state) {
$names = array();
foreach (element_children($elements['items']) as $item_key) {
$element =& $elements['items'][$item_key];
if ($element['name']['#value'] || $element['type']['#value']) {
foreach (array(
'name' => t('Name'),
'type' => t('Data type'),
) as $key => $title) {
if (!$element[$key]['#value']) {
form_error($element[$key], t('!name field is required.', array(
'!name' => $title,
)));
}
}
if (isset($names[$element['name']['#value']])) {
form_error($element['name'], t('The name %name is already taken.', array(
'%name' => $element['name']['#value'],
)));
}
$names[$element['name']['#value']] = TRUE;
}
if ($element['type']['#value'] == 'hidden' && $element['default_value']['#value'] === '') {
form_error($element['default_value'], t('The "hidden" data type requires a default value.'));
}
}
}