PHP 클래스 yii\widgets\MaskedInput

MaskedInput is similar to [[Html::textInput()]] except that an input mask will be used to force users to enter properly formatted data, such as phone numbers, social security numbers. 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', ]); ~~~ The masked text field is implemented based on the jQuery masked input plugin.
부터: 2.0
저자: Qiang Xue ([email protected])
상속: extends InputWidget
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$aliases custom aliases to use. Should be configured as maskAlias => settings, where - maskAlias is a string containing a text to identify your mask alias definition (e.g. 'phone') and - settings is an array containing settings for the mask symbol, exactly similar to parameters as passed in [[clientOptions]].
$clientOptions the JQuery plugin options for the input mask plugin.
$definitions custom mask definitions to use. Should be configured as maskSymbol => settings, where - maskSymbol is a string, containing a character to identify your mask definition and - settings is an array, consisting of the following entries: - validator: string, a JS regular expression or a JS function. - cardinality: int, specifies how many characters are represented and validated for the definition. - prevalidator: array, validate the characters before the definition cardinality is reached. - definitionSymbol: string, allows shifting values from other definitions, with this definitionSymbol.
$mask the input mask (e.g. '99/99/9999' for date input). The following characters can be used in the mask and 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) - [ and ]: anything entered between the square brackets is considered optional user input. This is based on the optionalmarker setting in [[clientOptions]]. Additional definitions can be set through the [[definitions]] property.
$options the HTML attributes for the input tag.
$type the type of the input tag. Currently only 'text' and 'tel' are supported.

보호된 프로퍼티들

프로퍼티 타입 설명
$_hashVar the hashed variable to store the pluginOptions

공개 메소드들

메소드 설명
init ( ) Initializes the widget.
registerClientScript ( ) Registers the needed client script and options.
run ( )

보호된 메소드들

메소드 설명
hashPluginOptions ( View $view ) Generates a hashed variable to store the plugin clientOptions. Helps in reusing the variable for similar options passed for other widgets on the same page. The following special data attribute will also be added to the input field to allow accessing the client options via javascript:
initClientOptions ( ) Initializes client options

메소드 상세

hashPluginOptions() 보호된 메소드

- 'data-plugin-inputmask' will store the hashed variable storing the plugin options.
저자: [Thiago Talma](https://github.com/thiagotalma)
protected hashPluginOptions ( View $view )
$view yii\web\View the view instance

init() 공개 메소드

Initializes the widget.
public init ( )

initClientOptions() 보호된 메소드

Initializes client options
protected initClientOptions ( )

registerClientScript() 공개 메소드

Registers the needed client script and options.

run() 공개 메소드

public run ( )

프로퍼티 상세

$_hashVar 보호되어 있는 프로퍼티

the hashed variable to store the pluginOptions
protected $_hashVar

$aliases 공개적으로 프로퍼티

custom aliases to use. Should be configured as maskAlias => settings, where - maskAlias is a string containing a text to identify your mask alias definition (e.g. 'phone') and - settings is an array containing settings for the mask symbol, exactly similar to parameters as passed in [[clientOptions]].
public $aliases

$clientOptions 공개적으로 프로퍼티

the JQuery plugin options for the input mask plugin.
또한 보기: https://github.com/RobinHerbots/jquery.inputmask
public $clientOptions

$definitions 공개적으로 프로퍼티

custom mask definitions to use. Should be configured as maskSymbol => settings, where - maskSymbol is a string, containing a character to identify your mask definition and - settings is an array, consisting of the following entries: - validator: string, a JS regular expression or a JS function. - cardinality: int, specifies how many characters are represented and validated for the definition. - prevalidator: array, validate the characters before the definition cardinality is reached. - definitionSymbol: string, allows shifting values from other definitions, with this definitionSymbol.
public $definitions

$mask 공개적으로 프로퍼티

the input mask (e.g. '99/99/9999' for date input). The following characters can be used in the mask and 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) - [ and ]: anything entered between the square brackets is considered optional user input. This is based on the optionalmarker setting in [[clientOptions]]. Additional definitions can be set through the [[definitions]] property.
public $mask

$options 공개적으로 프로퍼티

the HTML attributes for the input tag.
또한 보기: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $options

$type 공개적으로 프로퍼티

the type of the input tag. Currently only 'text' and 'tel' are supported.
또한 보기: https://github.com/RobinHerbots/jquery.inputmask
부터: 2.0.6
public $type