You are here

function wsclient_ui_operation_name_validate in Web service client 7

Validation callback for operation names.

1 string reference to 'wsclient_ui_operation_name_validate'
wsclient_ui_operation in wsclient_ui/wsclient_ui.inc
Operation form.

File

wsclient_ui/wsclient_ui.inc, line 867
WSClient UI - implements service description management and configuration screens.

Code

function wsclient_ui_operation_name_validate($element, &$form_state) {
  if ($element['#value'] && !preg_match('!^[A-Za-z0-9_]+$!', $element['#value'])) {
    form_error($element, t('Operation names must contain only letters, numbers, and underscores.'));
  }
  if ($element['#value'] != $form_state['operation']['name'] && isset($form_state['service']->operations[$element['#value']])) {
    form_error($element, t('An operation with that name already exists'));
  }
}