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

Length-based validation + "password" is correct input field type #601

Closed
wants to merge 5 commits into from
Closed

Conversation

kstep
Copy link
Contributor

@kstep kstep commented Oct 17, 2011

First I added missing validation method based on field length. I use "minlength" and "maxlength" 's attributes to set min and max value length, and set input.$error.MINLENGTH and input.$error.MAXLENGTH in case field's value is too short/long.

The second commit a fix: <input type="password" /> kept converted to <input type="text" /> by angular.js, which made it effectively useless for forms handling. I added "password" type to the list of correct HTML5 input types

@kstep
Copy link
Contributor Author

kstep commented Oct 19, 2011

Here, take a look at this test. Shall it go?

@kstep
Copy link
Contributor Author

kstep commented Oct 19, 2011

BTW, I don't know why you used ng:pattern as there's standard HTML5 attribute.

@IgorMinar
Copy link
Contributor

we used ng:pattern because it behaves significantly different from pattern (pattern takes regexp without /s as wrappers, which make unboundable)

@IgorMinar
Copy link
Contributor

the password related commits landed as e82e64d

@kstep
Copy link
Contributor Author

kstep commented Oct 19, 2011

Rebased my version on top of your work.
Also included one small bugfix: the ng:pattern spoiled my patterns but cutting trailing char from my patterns, so ng:pattern="/^\S+$/" was turned into /^\S+/, not to /^\S+$/ as it should be.

@IgorMinar
Copy link
Contributor

btw I simplified the test slightly

@IgorMinar
Copy link
Contributor

ng:minlength and ng:maxlength landed as a part of this push:

[angular.js] IgorMinar pushed 3 new commits to master: http://git.io/XcIGEg

I added some more docs, tests and e2e tests.

@IgorMinar
Copy link
Contributor

Thanks for pointing out the issue with ng:pattern. I decided to use substr instead (fewer bytes) and added a test. the fix is now in the master branch:

[angular.js] IgorMinar pushed 1 new commit to master: http://git.io/iDfGow

@IgorMinar
Copy link
Contributor

Thanks for all work. This was very helpful. In the future, to make it easier for you to manage all changes, I suggest that you create a separate branch for the pull request. That way you don't need to clean up your master and remove all commits before syncing with our master branch. For more info please see: http://docs.angularjs.org/#!/misc/contribute

Lastly, I'd like to send you an AngularJS T-shirt. Can you please fill out this form: http://goo.gl/D9uOx

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

Successfully merging this pull request may close these issues.

2 participants