Found an odd issue related to a masked edit field, using a CMaskedTextField with the following code in a form
echo $form->labelEx($model,'int_tel');
$this->widget('CMaskedTextField', array(
'model' => $model,
'attribute' => 'int_tel',
'mask' => '(99)? 9999xx9999',
'charMap' => array('x'=>'[0-9x\-\s]', '9' =>'[0-9]'),
));
echo $form->error($model,'int_tel');
This accepts a Brazillian Phone number with DDD and number of 8 or 9 digits, with / without the dash
This works great EXCEPT if the user hits ENTER to submit the form WHILE on this particular field.
If the user hits ENTER on that field to submit the form the default placeholder is not stripped from the data submitted (I watched it in firebug). If the form is submitted with the SUBMIT button (implies user has left the field) the placeholder is stripped prior to sending back to the server on submit.
It seems that the CMaskedTextField is not performing the stripping of the placeholder when the use user is active on that field and the user hits ENTER to submit the form.
I suspect that since all characters are not filled in (with an 8 digit number) the placeholder is still in the string since my guess an onexit() function is never called when the form is submitted with the ENTER.
It’s an odd case but about the only way I have seen that fixes the issue is to set the place holder to a empty with
echo $form->labelEx($model,'int_tel');
$this->widget('CMaskedTextField', array(
'model' => $model,
'attribute' => 'int_tel',
'mask' => '(99)? 9999xx9999',
'charMap' => array('x'=>'[0-9x\-\s]', '9' =>'[0-9]'),
'placeholder' => '', // just override placeholder with no placeholder keeps safe
));
echo $form->error($model,'int_tel');
Sandy