M
M
Messi2018-03-19 19:36:03
Yii
Messi, 2018-03-19 19:36:03

Numbers and figures in a mask?


Can you please tell me how to specify a mask of the form: AAAA-AAAA-AAAA-AAAA for input when using the MaskedInput widget , only so that you can enter not only letters but also numbers?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-03-19
@FitTech

Good evening.
Specify "*" in the widget settings, which allows you to enter both letters and numbers. Also specify the placeholder value

echo $form->field($model, 'phone')->widget(MaskedInput::class, [
    'mask' => ['****-****-****-****'],
    'options' => [
        'placeholder' => 'AAAA-AAAA-AAAA-AAAA'
    ]
]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question