Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve the code example #27

Open
michaelnguyen2021 opened this issue May 2, 2017 · 0 comments
Open

improve the code example #27

michaelnguyen2021 opened this issue May 2, 2017 · 0 comments
Assignees

Comments

@michaelnguyen2021
Copy link

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()],
    }
}
@Borales Borales self-assigned this May 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants