You can look at this http://www.yiiframework.com/doc/api/1.1/CMaskedTextField to make CMaskedTextField that give you the alternative way to give preformatted textfield.
Oke let's take look the code :
$this->widget('CMaskedTextField', array( 'model' => $model, 'attribute' => 'aluguel', 'mask' => '(999) 999-9999? x99999', 'htmlOptions' => array('size' => 6) ));This is with the regex types
$this->widget('CMaskedTextField', array( 'model' => $model, 'attribute' => 'aluguel', 'mask' => '9.999,99', 'charMap' => array('.'=>'[\.]' , ','=>'[,]'), 'htmlOptions' => array('size' => 6)));And the final code you can see below the result here is:
.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)
No comments:
Post a Comment