CMaskedTextField optional part is allowed partially entered

I’m using a CMaskedTextField for a zipcode, using this mask:

"99999?-9999"

Which means that it should allow exactly 5 digits followed by an optional dash and 4 digits more.

But the optional part, after the ? is accepted whether it’s complete (4 digits) or not, accepting any amount of digits, from none to 4.

I used the JUI plugin in which this widget is based, and didn’t seem to find a workaround for this, is there any?


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

	'model' => $model,

	'attribute' => 'zip',

	'mask' => '99999?-9999',

	));