Hello all,
I am relatively new with yii2 and would like to learn with your help.
My problem is, I have a ActiveForm and a field where I want to put in a number with i.e. “14,58” and it should be converted into “14.58”.
The value I want to change is the value of ‘betrag’.
Source:
<?php $form = ActiveForm::begin(['action' => [$_action],]);?>
<?= $form->field($model, 'betrag', ['template' => '{label}{input}{error}{hint}','options' => ['class' => 'form-group form-inline'] ])->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Speichern' : 'Speichern', ['class' => $model->isNewRecord ? 'btn form-inline' : 'btn form-inline']) ?>
</div>
<?= $form->field($model, 'wer', ['template' => '{label}{input}{error}{hint}','options' => ['class' => 'form-group form-inline']])->hiddenInput(['maxlength' => true,])->label('');?>
<?php ActiveForm::end(); ?>
I found some examples and tried to use it, but inexperienced as I am I had problems to integrate it:
$field($model, ‘betrag’);
$field = str_replace(’,’, ‘.’, $field);
Thanks in advance for your help,
keem
PS: If you can recommend any good tutorials to learn about Yii2 I would appreciate it.