H
H
hollanditkzn2017-08-11 15:11:08
Yii
hollanditkzn, 2017-08-11 15:11:08

How to convert currency to number?

I am using maskedinput yii2 widget. After saving, it does not save me, writes that the field must be a number. How to convert to number and remove all other characters?
Here is the code I am using

<?= $form->field($model, 'oplata')->widget(MaskedInput::className(), [
                    'clientOptions' => [
                        'alias' => 'decimal',
                        'groupSeparator' => '.',
                        'autoGroup' => true,
                    ],
                'options' => ['placeholder' => 'Cтоимость', 'class' => 'inputWidget-form'],
            ])->label(false) ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
muhammadkhon, 2017-08-11
@muhammadkhon

Please show the rule for this field from the model and the data entry format.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question