Skip to content

Instantly share code, notes, and snippets.

@seabrizz
Last active December 10, 2019 13:52
Show Gist options
  • Save seabrizz/7c4a7986333b5cc68b58a4122487e3a1 to your computer and use it in GitHub Desktop.
Save seabrizz/7c4a7986333b5cc68b58a4122487e3a1 to your computer and use it in GitHub Desktop.
//jQuery
$('.phoneMask').inputmask("+38 (999) 999-99-99");
//snippet MODX name: phoneValid
<?php
$success = true;
$value = trim($value);
if (!preg_match('/[+]38 [(][0-9]{3}[)] [0-9]{3}[-][0-9]{2}[-][0-9]{2}/', $value)) {
$success = false;
$validator->addError($key, 'Введите номер телефона');
}
return $success;
//MODX Chunk
[[!AjaxForm?
&customValidators=`phoneValid`
&validate=`name:minLength=^3^,phone:phoneValid`
]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment