PHP development framework Yii Framework tutorial (14) UI component MaskedTextField example

黄舟
Release: 2023-03-05 07:38:01
Original
1093 people have browsed it

CMaskedTextField is a format input box. You can specify a Mask for the text box to restrict the text format that users can enter and exit. For example, using 99.99.9999 in this example can only allow the input of text similar to dates.

Modify View and add CMaskedTextField component

widget
('CMaskedTextField',array('model'=>$model,'attribute'=>'date','name'=>'date','mask'=>'99.99.9999',
'htmlOptions'=>array('style'=>'width:80px;'),));?>
Copy after login

In order to cooperate with CMaskedTextField, we modify DataModel and add an attribute date

class
DataModel extends CFormModel{public $date;
public function rules(){
return array(array('date', 'safe'),);
}
}
Copy after login

PHP development framework Yii Framework tutorial (14) UI component MaskedTextField example

The above is the content of the PHP development framework Yii Framework tutorial (14) UI component MaskedTextField example. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!