I have a form like this
When pressed on “add more contacts” more phone number field will be added
I used an array for declaring the model. Here values will save perfectly. But contact mask and validation not working for me
Form field is like this
<?=$form->field ( $model, ‘contact[]’
, [‘options’=>[‘class’=>’’]
, ‘wrapperOptions’=>[‘class’=>’’]
])->widget ( \yii\widgets\MaskedInput::className (),
[ ‘name’ => ‘input-1’,‘mask’ => ‘(999)-999-9999’
])->textInput([‘placeholder’ => ‘(999)-999-9999’])->label(false);
?>
Since the mask is not working I added a placeholder here. Then Tried to add a validation like below
My validation code like this
[‘more_contact’, ‘each’, ‘rule’ => [‘integer’,‘min’=>10,‘max’=>‘12’]],
But this also not working for me.How can I solve this problem?