Ionic Angular: uppercasing form field value does not work on last character

Discussão em 'Angular' iniciado por NorthFred, Novembro 20, 2024.

  1. NorthFred

    NorthFred Guest

    In order to uppercase the textual input in a form's field, I have following code:

    <ion-item>
    <ion-input label="Registration number *" labelPlacement="stacked" formControlName="carRegNr" type="text" autocapitalize="characters" placeholder="Registration number" clearInput="true" oninput="this.value = this.value.toUpperCase()">
    </ion-input>
    </ion-item>


    Problem now is that the last character of the input does not get capitalized. I.e. when I have a reference to the field value, it is shown as e.g. "CAR-REGi"

    <span *ngIf="taskForm.value.carRegNr" class="form-header-label-text">{{taskForm.value.carRegNr}}</span>


    Also when sending the value to the back-end, "CAR-REGi" is saved.

    Am I overlooking something? How can I make sure the full string is uppercased?

    Continue reading...

Compartilhe esta Página