Borales / yii2-phone-input

Yii2 International telephone numbers
Other
135 stars 55 forks source link

fail validation how fix this?) #53

Open atomrus1993 opened 6 years ago

atomrus1993 commented 6 years ago

image image image i need rules only integer, +, space, '(', ')'

atomrus1993 commented 6 years ago

i add filter

['phone', 'filter', 'filter' => [$this, 'normalizePhone']],
public function normalizePhone($value) {
        $phone = preg_match("@[A-z]@u", $value);
        return !$phone ? $value : false;
}

if you know good method, please say me)

And please add this code to Readme.md

My problem is that if we enter the phone in my case for Russia, and if there is a letter, then the validator thinks everything is ok, but this is not so, so I wrote an example of how I realized that there were real data, the letters are not needed) Please add this to the description of your extension.