yii-dynamic-mask A jQuery based dinamic mask input

  1. Requirements
  2. Usage
  3. Resources

A jQuery based dinamic mask input. A wrapper for http://digitalbush.com/projects/masked-input-plugin/

It allows a user to more easily enter fixed width input where you would like them to enter the data in a certain format (dates, phone numbers, etc).

A mask is defined by a format made up of mask literals and mask definitions. Any character not in the definitions list below is considered a mask literal. Mask literals will be automatically entered for the user as they type and will not be able to be removed by the user. The following mask definitions are predefined:

  • a - Represents an alpha character (A-Z,a-z)

  • 9 - Represents a numeric character (0-9)

  • * - Represents an alphanumeric character (A-Z,a-z,0-9)

Requirements

Yii 1.1 or above

Usage

Put the files under the application extensions directory.

$this->widget('application.extensions.dynamicmask.DMask', array(
    'element' => '#some_field, #another_field, #one_more_field',
    'mask' => '999-9999-999',
));
$this->widget('application.extensions.dynamicmask.DMask', array(
    'element' => '#date_field',
    'mask' => '99/99/9999',
    'config' => array(
      'placeholder' => "mm/dd/yyyy",
    ),
));
$this->widget('application.extensions.dynamicmask.DMask', array(
    'element' => '#phone_field',
    'mask' => '(999) 999-9999',
));

Resources

1 0
3 followers
193 downloads
Yii Version: 1.1
License: MIT
Category: User Interface
Developed by: Phelipe Folgierini
Created on: Jan 29, 2015
Last updated: 3 years ago

Downloads

show all

Related Extensions