You are here

function sms_send_form_validate in SMS Framework 6

Same name and namespace in other branches
  1. 5 sms.module \sms_send_form_validate()
  2. 6.2 sms.module \sms_send_form_validate()
  3. 7 sms.module \sms_send_form_validate()

Send form validation.

1 string reference to 'sms_send_form_validate'
sms_devel_send_form in modules/sms_devel/sms_devel.send_form.inc
Test send form

File

./sms.module, line 415
The core of the SMS Framework. Provides gateway managment and API for sending and receiving SMS messages.

Code

function sms_send_form_validate($form, &$form_state) {
  if (!array_key_exists('message', $form_state['values']) || empty($form_state['values']['message'])) {
    form_set_error('message', t('You must enter a message to send.'));
  }
  $number = trim($form_state['values']['number']);
  if ($error = sms_validate_number($number, array(
    'prefix' => $form_state['values']['country'],
  ))) {
    form_set_error('number', t($error));
  }

  // The number may have been changed by the validation function.
  //   Make sure we preserve the change.
  $form_state['values']['number'] = $number;
}