Seeing ineersa ukphonevalidator, I remember I add a validator for french phone numbers, so I made it working with Yii
Requirements ¶
Yii 1.1
Usage ¶
Extract FRPhoneValidator.php to your extension directory.
You can now use it as validation rule:
public function rules()
{
return array(
array('phone', 'application.extensions.FRPhoneValidator')
);
}
I kept the allowEmpty possibility.
Petite erreur
Thanks for this validator, it works after a litle modification line 31 to 36:
if($value===null || $value==='') { if($this->allowEmpty) { return true; } else { $message=$this->message!==null?$this->message:Yii::t('yii','{attribute} is empty'); $this->addError($object,$attribute,$message); } }
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.