I use the mask for the phone number entry field

$form->field($model, 'phone')->textInput(['value'=>$info['phone']])->widget(\yii\widgets\MaskedInput::className(), ['mask' => '+7 (999)-999-9999']); 

Everything works well, but after saving it does not display a value, although it is not empty.

 textInput(['value'=>$info['phone']]) 

What could be the problem?

  • And without a mask displays? - Kison
  • without a mask shows - Diefair

1 answer 1

You specify an unsupported mask format. Read here .

Supported values:

  • a: alphabet characters (AZ, az)
  • 9: numbers (0-9)
  • *: both numbers and numbers (AZ, az, 0-9)
  • [and]: optional marker.

In your case of +7 I would output as text or a label before the input.