Igniteui-angular: IgxInput does not remove validation error style after the form is reset

Created on 24 Jul 2019  路  4Comments  路  Source: IgniteUI/igniteui-angular

Description

IgxInput does not remove its validation error style after the form is reset.

  • igniteui-angular version: 8.1.0
  • browser: any

Steps to reproduce

  1. Run the attached sample
  2. Set focus on Name field
  3. Set focus on Price field
  4. Click "reset state" button
    IgxInput_Validation

Result

Form state is reset but the Name field and Price field keep invalid style.

Expected result

Name field and Price field does not have invalid style.

Attachments

igx-input-group.zip

bug input input-group medium resolved 8.1.x

Most helpful comment

This issue should be fixed in next version. One note. If developer changes the value of any input by calling setValue or patchValue the input may or may not show validation errors. Here is how input should work by specification:

  • if input is pristine and untouched it will never show validation errors whatever value developer sets through code behind.
  • if input is touched or dirty:

    • if developer sets correct value through code behind form will not show validation errors.

    • if develper sets incorrect value through code behind form will show validation errors.

If developer needs to set invalid value, e.g. null or undefinde on touched or dirty form, and need to hide validation errors, he should call reset to make input pristine and untouched.

All 4 comments

any update for this issue ?

+1

@GeanAlexandre, @PixelShoot we are starting to work on this. Regards!

This issue should be fixed in next version. One note. If developer changes the value of any input by calling setValue or patchValue the input may or may not show validation errors. Here is how input should work by specification:

  • if input is pristine and untouched it will never show validation errors whatever value developer sets through code behind.
  • if input is touched or dirty:

    • if developer sets correct value through code behind form will not show validation errors.

    • if develper sets incorrect value through code behind form will show validation errors.

If developer needs to set invalid value, e.g. null or undefinde on touched or dirty form, and need to hide validation errors, he should call reset to make input pristine and untouched.

Was this page helpful?
0 / 5 - 0 ratings