Skip to content

Apply .mat-input-invalid on empty required fields at pristine #4030

Closed

Description

@AlanCrevon

Bug, feature request, or proposal:

Request

What is the expected behavior?

.mat-input-invalid class should be added to empty required fields on pristine.

What is the current behavior?

.mat-input-invalid is added only if the field has validator and has been touched.

What is the use-case or motivation for changing an existing behavior?

Empty mandatory fields should be visible at first sight.

Which versions of Angular, Material, OS, browsers are affected?

Angular 4.0.1
Material2 Beta 3

Is there anything else we should know?

I love you. ;)

Activity

  1. jelbourn commented on Apr 11, 2017

    @jelbourn
    Contributor

    For this we follow the material design spec, which calls for

    Show errors for incompatible values during or after a user interacts with a text field.

  2. AlanCrevon commented on Apr 12, 2017

    @AlanCrevon
    Author

    Ho... i see. Ok thanks for the answer. :)

  3. leblancmeneses commented on Jun 27, 2017

    @leblancmeneses

    Is there plan to add md-is-error angular/material#1633 ?

    There are some cases I want to show an error even if it is untouched.
    Example:
    Expense: input[type="number"]
    Expense itemization: textarea where [required]="selectedEvent.miscExpenses && selectedEvent.miscExpenses > 0"

    The user doesn't know that there is a problem with the form. I would like to force a visual with md-is-error.

    Otherwise, I have to begin adding tooltips to explain to the user why the button is disabled.
    tooltip

  4. willshowell commented on Jun 27, 2017

    @willshowell
    Contributor

    @leblancmeneses #4750 should accomplish what you need

  5. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  6. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions