Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Pristine controls stay pristine after form submit #7850

Closed

Description

@dmitrymushenko

It seems that changing control to dirty must stand before last committed view value check in $commitViewValue function in https://github.com/angular/angular.js/blob/0ebab08e66f953397b044be9533d764961fbc9ea/src/ng/directive/input.js.
Lines 1789 - 1796 move before line 1784.

Activity

  1. rodyhaddad commented on Jun 29, 2014

    @rodyhaddad
    Contributor

    At first glance, we don't want to set a field as dirty if we're not actually changing the value, so this works as expected.

    Mind posting a plunkr showcasing when this is an issue?

  2. added this to the Purgatory milestone on Jun 29, 2014
  3. dmitrymushenko commented on Jul 1, 2014

    @dmitrymushenko
    Author

    In some of 1.3.0 betas it worked in such way (beta 8, I think). And it was useful for me. But You are right, maybe it is not what we expect by default.

    It can be useful in case like this. For example, there is a login form. There are also two required inputs on this form: username and password. I put some css on inputs, when they are .ng-invalid-required and .ng-dirty (to show user, that they are required). If we just press "submit" on form, nothing will happen. There must be handler to show user, that username and password are required.
    But if controls will become dirty on submit, there will be no need in additional handler.

    http://plnkr.co/edit/WLJDE8XEdYHtBSUFrQXe?p=preview

  4. rodyhaddad commented on Jul 10, 2014

    @rodyhaddad
    Contributor

    #8056 should introduce a .ng-submitted class that you'll be able to use for your scenario.

    Thanks for making us aware of it! :-)

  5. modified the milestones: , Purgatory on Jul 11, 2014
  6. rodyhaddad commented on Jul 11, 2014

    @rodyhaddad
    Contributor

    Let's keep this open till #8056 gets merged
    You never know what will end up happening to it :-)

  7. dmitrymushenko commented on Jul 11, 2014

    @dmitrymushenko
    Author

    Ok :)
    Thanks for attention!

  8. rodyhaddad commented on Aug 1, 2014

    @rodyhaddad
    Contributor

    .ng-submitted is now a thing, woo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions