Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

TextArea validation #56

Closed
LennyLip opened this issue Aug 9, 2015 · 7 comments
Closed

TextArea validation #56

LennyLip opened this issue Aug 9, 2015 · 7 comments

Comments

@LennyLip
Copy link
Contributor

LennyLip commented Aug 9, 2015

I searched, but did not find an answer

I have:
textarea name="description" validation="min_len:50|max_len:2000|required"

When i type Enter (new line) validation error is fired. Why?

@ghiscoding
Copy link
Owner

It's only suppose to fire after the user stop typing, by default it's 1sec. Even on my plunker demo, it doesn't do what you just describe, try my demo and you'll see. Did you define any Global Variable of Angular-Validation?

If you could make a plunker demo, that would help in debugging, without that it's hard to help you more

@LennyLip
Copy link
Contributor Author

LennyLip commented Aug 9, 2015

@LennyLip
Copy link
Contributor Author

LennyLip commented Aug 9, 2015

from demo http://plnkr.co/jADq7H
124

@LennyLip LennyLip changed the title TextArea vaidation TextArea validation Aug 9, 2015
@ghiscoding
Copy link
Owner

So your problem is around the fact that when you do a ENTER, the min_len becomes incorrect. Do I understand correctly?

@ghiscoding
Copy link
Owner

Ok you were right, I found out that a new line (ENTER) is breaking the Regex that I was using on min_len, between_len and max_len.

On min_len, I was using this Regex /.{15,}$/ but this doesn't work with a new line
Found out that I could do this instead /(.|[\r\n]){15,}$/ and that is working with a new line

I will update the 3 rules in the validation-rules.js and that should fix it.

https://regex101.com/#javascript

Previous rules, was giving no match
regex-error

After new fix, finding a match
regex

@ghiscoding
Copy link
Owner

Should be all good now... thanks for the feedback!

@LennyLip
Copy link
Contributor Author

Many thanks for help!
All ok now.

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