You are here

function sms_user_send_sms_action_validate in SMS Framework 7

Same name and namespace in other branches
  1. 6.2 modules/sms_user/sms_user.actions.inc \sms_user_send_sms_action_validate()

Form validation handler for the 'Send SMS to Users' action.

File

modules/sms_user/sms_user.actions.inc, line 64
SMS User Action Implementation.

Code

function sms_user_send_sms_action_validate($form, $form_state) {
  $sms_text = $form_state['values']['sms_text'];
  if (empty($sms_text)) {
    form_set_error('sms_text', t('This field is required'));
  }
  $length = drupal_strlen($sms_text);
  if ($length > variable_get('sms_user_max_chars', SMS_USER_MAX_CHARS)) {
    $error = t('SMS too long: (@text) [length=@len]', array(
      '@text' => $sms_text,
      '@len' => $length,
    ));
    form_set_error('sms_text', $error);
  }
}