Skip to content

kartik-v/yii2-maskedinput

 
 

Repository files navigation

Masked Input Extension for Yii 2


This is the Masked Input extension for Yii framework 2.1. It provides a masked input widget based on jQuery Input Mask plugin.

For license information check the LICENSE-file.

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiisoft/yii2-maskedinput

or add

"yiisoft/yii2-maskedinput": "~1.0.0"

to the require section of your composer.json file.

Usage

To use MaskedInput, you must set the [[mask]] property. The following example shows how to use MaskedInput to collect phone numbers:

echo MaskedInput::widget([
    'name' => 'phone',
    'mask' => '999-999-9999',
]);

You can also use this widget in an [[ActiveForm]] using the [[ActiveField::widget()|widget()]] method, for example like this:

<?= $form->field($model, 'from_date')->widget(\yii\widgets\MaskedInput::className(), [
    'mask' => '999-999-9999',
]) ?>

About

Masked input field widget

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%