Skip to content
This repository was archived by the owner on Sep 4, 2019. It is now read-only.

Hiding validation messages for "pristine" fields #2

Closed
hades200082 opened this issue Nov 21, 2014 · 5 comments
Closed

Hiding validation messages for "pristine" fields #2

hades200082 opened this issue Nov 21, 2014 · 5 comments
Assignees

Comments

@hades200082
Copy link

Is there a way to hide the validation messages for pristine fields?

@mdekrey
Copy link
Owner

mdekrey commented Nov 22, 2014

I believe this is handled in the library as-written, unless you're suggesting after the submit button is pressed. If that is the case, I'd recommend currently to use a data-val-if to test if the model is different from your default value.

If I'm wrong, or you have a suggestion for providing the default pristine value, could you provide a gist?

Thanks!

@hades200082
Copy link
Author

I mean that we don't want the messages to appear just because the user has
clicked into the field and then on something else.

Currently the messages appear when the field is touched and invalid.

We want it to be when dirty and invalid instead.

Can this be done through configuration?
On 22 Nov 2014 22:12, "Matt DeKrey" notifications@github.com wrote:

I believe this is handled in the library as-written, unless you're
suggesting after the submit button is pressed. If that is the case, I'd
recommend currently to use a data-val-if to test if the model is different
from your default value.

If I'm wrong, or you have a suggestion for providing the default pristine
value, could you provide a gist?

Thanks!


Reply to this email directly or view it on GitHub
#2 (comment)
.

@mdekrey
Copy link
Owner

mdekrey commented Dec 4, 2014

Ah, this can't be done yet, but is a good idea for an addition!

@mdekrey mdekrey self-assigned this Dec 4, 2014
@hades200082
Copy link
Author

Looks like Angular 1.3.5 added a new updateOn option for "submit" a couple of days ago.

angular/angular.js#7017
angular/angular.js@a0ae07b

Not in their general release yet.

@mdekrey
Copy link
Owner

mdekrey commented Jul 25, 2015

Using the updated version of angular, you can add val-if="!inputName.$pristine" as an attribute, and it should be picked up with prior versions. This will be added as a config-time option in the next major release for those that don't want to configure it per field.

@mdekrey mdekrey closed this as completed Jul 25, 2015
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

2 participants