function _clientside_validation_ajax_call in Clientside Validation 7
Same name and namespace in other branches
- 6 clientside_validation.module \_clientside_validation_ajax_call()
1 string reference to '_clientside_validation_ajax_call'
- clientside_validation_menu in ./
clientside_validation.module - Implements hook_menu().
File
- ./
clientside_validation.module, line 193 - Add client side validation to forms.
Code
function _clientside_validation_ajax_call() {
$param = $_POST['param'];
$value = (string) $_POST['value'];
$result = array();
foreach ($param['expressions'] as $key => $regex) {
if (!(bool) preg_match($regex, $value)) {
$result = array(
'result' => FALSE,
'message' => $param['messages'][$key],
);
break;
}
}
if (empty($result)) {
$result = array(
'result' => TRUE,
);
}
drupal_json_output($result);
}