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

Enhanced form examples to utilize $touched #10066

Closed
wants to merge 2 commits into from

Conversation

supersonicclay
Copy link
Contributor

The "Binding to form and control state" example now more closely reflects how users will accomplish form validation in 1.3. For example, users are now informed of validation requirements upon clicking Save.

The "Binding to form and control state" example now more closely reflects how users will accomplish form validation in 1.3. For example, users are now informed of validation requirements upon clicking Save.
@mary-poppins
Copy link

I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS.

Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match.

If you signed the CLA as a corporation, please let us know the company's name.

Thanks a bunch!

PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR.
PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

@gkalpak
Copy link
Member

gkalpak commented Nov 14, 2014

I don't really see how this is closer to how form-validation is done in 1.3.
It is quite a different approach from the previous example, but both are valid and useful in their own right.

@PatrickJS
Copy link
Contributor

+1

@supersonicclay
Copy link
Contributor Author

@gkalpak You're correct. It isn't really accurate to say this is "how form validation is done in 1.3".

I believe this pull request has the following benefits:

  • Demonstrates features that only exist in 1.3 (e.g. $submitted and $touched)
  • User is shown validation errors upon clicking submit
  • User is only shown validation errors upon blur instead of immediately on first key press
  • User is shown validation errors upon interacting with (touching) a field

- RESET button is enabled only if form has some changes
- SAVE button is enabled only if form has some changes and is valid
- custom error messages for `user.email` and `user.agree`
- Custom error message displayed upon interacting (touching) a field or submitting the form
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really correct. "Touching" implies (to me) the error is added when the input is focused, but it's actually only set when it is blurred.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Angular 1.3 has defined touched to mean that the control has been blurred.

See https://docs.angularjs.org/guide/forms

ng-touched: the control has been blurred

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know. But the text is still not clear

Custom error message displayed upon interacting (touching) a field

For somone who doesn't know angular this sounds like the class will be set immediately on interacting or touching the input. Interacting is misleading, touching is ambiguous.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Good feedback.

@petebacondarwin
Copy link
Contributor

Hi @claycephas - can you ensure that you have signed the CLA and that your GitHub account name is there. See https://cla.developers.google.com/clas

@petebacondarwin petebacondarwin added this to the 1.3.5 milestone Nov 20, 2014
@supersonicclay
Copy link
Contributor Author

Signed. Thanks.

@googlebot
Copy link

CLAs look good, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants