Last active
December 10, 2019 13:52
-
-
Save seabrizz/7c4a7986333b5cc68b58a4122487e3a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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