You are here

function nodejs_add_user_to_channel_form_validate in Node.js integration 6

Same name and namespace in other branches
  1. 7 nodejs.module \nodejs_add_user_to_channel_form_validate()

Form validate callback - add a user to a channel on the Node.js server.

_state

Parameters

mixed $form:

Return value

void

File

./nodejs.module, line 345

Code

function nodejs_add_user_to_channel_form_validate($form, &$form_state) {
  $values = (object) $form_state['values'];
  if (!preg_match('/^\\d+$/', $values->nodejs_uid)) {
    form_set_error('nodejs_uid', t('Invalid uid - please enter a numeric uid.'));
  }
  if (!preg_match('/^([a-z0-9_]+)$/i', $values->nodejs_channel)) {
    form_set_error('nodejs_channel', t('Invalid channel name - only numbers, letters and underscores are allowed.'));
  }
}