yii2-phone-input icon indicating copy to clipboard operation
yii2-phone-input copied to clipboard

improve the code example

Open michaelnguyen2021 opened this issue 7 years ago • 0 comments

Great extension but I have difficult time to follow your example to make it work for my use case

In your code example, you have 'phone_number', 'phone', and 'phoneInput' . They are confusing as there is little explanation on what they do.

My use case is I have 'primary_phone' and 'secondary_phone', after trial and error I got it working with the following

/** Model **/
use borales\extensions\phoneInput\PhoneInputValidator;
class Student extends ActiveRecord
{
    public $phone; // must declare other this extension wont work 

    public function behaviors()
    {
        return [
           PhoneInputBehavior::className(),
        ];
    }


    public function rules()
    {
        return [
            [['primary_phone', 'secondary_phone'], 'string', 'max' => 255],
            [['primary_phone', 'secondary_phone'], PhoneInputValidator::className()],
    }
}

michaelnguyen2021 avatar May 02 '17 18:05 michaelnguyen2021