You can try remove 'model' => null
like:
<?php echo CHtml::label(Yii::t('models', 'form.label.position'), 'position'); ?>
<?php
$this->widget('CMaskedTextField', array(
'name' => "position",
'mask' => '999',
'htmlOptions' => array(
'size' => 5,
'placeholder' => Yii::t('models', 'form.hint.position'),
'title' => Yii::t('models', 'form.hint.position'),
),
));
?>
In your widget, If you want to use your model
then you should remove name
and add attribute
.
Updated
In my form: I have a view with the form like:
<?php echo CHtml::beginForm('post/test', 'post'); ?>
<?php echo CHtml::errorSummary($model); ?>
<div class="row">
<?php echo CHtml::label(Yii::t('models', 'form.label.position'), 'position'); >
<?php
$this->widget('CMaskedTextField', array(
'name' => "position",
'mask' => '999',
'htmlOptions' => array(
'size' => 5,
'placeholder' => 'place holder',
'title' => 'title'
),
));
?>
</div>
<div class="row submit">
<?php echo CHtml::submitButton('test'); ?>
</div>
<?php echo CHtml::endForm(); ?>
And I also have a PostController that contains test
action like:
public function actionTest()
{
var_dump($_POST);
}
It's working fine.
array (size=2)
'position' => string '234' (length=3)
'yt0' => string 'test' (length=4)
So please make sure you have the Form is sent by POST method and it's submitted after you filled your maskedTextField.