pInputText label not working on reactive form update

Post Reply
kztyler
Posts: 2
Joined: 04 Oct 2016, 13:40

07 Dec 2017, 17:43

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">
        <label>Codigo</label>
      </span>
      <div class="input-error" *ngIf="determinacionForm.get('codigo').hasError('required') && determinacionForm.get('codigo').touched">
        Ingrese el Codigo
      </div>
    </div>
and this is the code of the component

Code: Select all

this.determinacionForm = this.fb.group({
      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
      });

    this.determinacionForm.patchValue(this.determinacion);
Image

merve7
Posts: 273
Joined: 12 Sep 2017, 10:44

15 Dec 2017, 14:59

What is your versions? Please, try with Angular v5 and PrimeNG 5

Post Reply

Return to “Ultima - PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest