Applying User Input Mask To Form Textbox

Hi,

I’d like to apply a user-input mask to a form textbox containg phone number data. I ran across:




<?php

$this->widget('CMaskedTextField', array(

'model' => $model,

'attribute' => 'aluguel',

'mask' => '9.999,99',

'htmlOptions' => array('size' => 6)

));

?>



I think I need to edit this to:




<?php

$this->widget('CMaskedTextField', array(

'model' => $model,

'attribute' => 'phone1',

'mask' => '(999) 999-9999',

'htmlOptions' => array('size' => 10)

));

?>



But, my confusion is where it goes. I’d guess it goes either in the View or the Controller, but _form already has a widget and I don’t see any similar php code in the Model Contoller. I tried looking around for other tutorials, but most thinks point back to Class Reference for CMaskedTextField. Anyone have any additional pointers??

It looks like replacing:




<?php echo $form->textField($model,'phone1',array('size'=>14,'maxlength'=>14)); ?>



with:




<?php

$this->widget('CMaskedTextField', array(

'model' => $model,

'attribute' => 'phone1',

'mask' => '(999) 999-9999',

'htmlOptions' => array('size' => 14)

));

?>



in View _form.php did the trick.