You are here

function _clientside_validation_ajax_phone in Clientside Validation 7

1 string reference to '_clientside_validation_ajax_phone'
clientside_validation_menu in ./clientside_validation.module
Implements hook_menu().

File

./clientside_validation.module, line 209
Add client side validation to forms.

Code

function _clientside_validation_ajax_phone() {
  $value = check_plain($_POST['value']);
  $country_code = check_plain($_POST['country_code']);
  if (function_exists('valid_phone_number') && !empty($country_code)) {
    $result['result'] = valid_phone_number($country_code, $value);
  }
  else {

    // elements module provides a telfield, but doesn't do any validation
    $result['result'] = TRUE;
  }
  drupal_json_output($result);
}