开发者

Is there a CMaskedTextField option that enables to not only separate user input with characters, but also in separate textboxes?

Is there a CMaskedTextField option that enables to not only separate user input with characters, but also in separate textboxes?

Im using CMaskedTextField to obtain this kind of re开发者_JS百科sult

Is there a CMaskedTextField option that enables to not only separate user input with characters, but also in separate textboxes?

However, I am actually trying to get this one

I was wondering if there was an option with CMaskedTextField that enables this feature, or in case there isnt, if anybody knows what is the most practical way in which it can be implemented. I know i could use javascript, but before i get into that im trying to squeeze Yii's provided functionalities as much as possible. Many many thks!


Found it. You need to specify the $placeholder property.

Example: In your view the widget should look like this

<?php $this->widget('CMaskedTextField', array(
                'mask'=>'99-9999-99',
                'name'=>'mask_tester',
                'placeholder'=>' ',
        )); ?>

Notice the placeholder is a space rather than default which is an underscore. Also, if you're passing a $model into the form you need to strike the $name property and add $model and $attribute properties.

However, this widget will never give you separate input boxes. It will always be in one input box.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜