Page 1 of 1

pInputText label not working on reactive form update

Posted: 07 Dec 2017, 17:43
by kztyler
I have a problem when using a simple text input with floating label, whenever i update the value of the fields in my form using patchValue, the UI keeps the label on top of the value of the field. I have tried focusing the element programatically and it doesnt fix it, but if you click on the actual element using the UI, then all the labels get fixed

this is the code of the view

Code: Select all

<div class="ui-g-12 ui-md-6">
      <span class="md-inputfield">
        <input #first type="text" pInputText formControlName="codigo">
      <div class="input-error" *ngIf="determinacionForm.get('codigo').hasError('required') && determinacionForm.get('codigo').touched">
        Ingrese el Codigo
and this is the code of the component

Code: Select all

this.determinacionForm ={
      codigo: ['', Validators.required],
      abreviatura: ['', Validators.required],
      nombre: ['', Validators.required],
      habilitado: [],
      tipo: [],
      protocoloId: [],
      especialidadId: ['', Validators.required],
      peso: ['', Validators.required],
      unidadesBioquimicas: ['', Validators.required],
      valoresReferencia: [],
      obrasSociales: [],
      derivada: [false]
    }, {
        validator: this.hasProtocolo


Re: pInputText label not working on reactive form update

Posted: 15 Dec 2017, 14:59
by merve7
What is your versions? Please, try with Angular v5 and PrimeNG 5