Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
AlanCrevon opened this issue Apr 11, 2017 · 5 comments
Closed

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

AlanCrevon opened this issue Apr 11, 2017 · 5 comments

Comments

@AlanCrevon
Copy link

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. ;)

@jelbourn
Copy link
Member

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.

@AlanCrevon
Copy link
Author

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

@leblancmeneses
Copy link

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

@willshowell
Copy link
Contributor

@leblancmeneses #4750 should accomplish what you need

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants