-
Notifications
You must be signed in to change notification settings - Fork 58
Numeric allows invalid numbers like "3.1.5" and "32.e.e3" #69
Comments
This is nested inside an ng-if. Wondering if this is just a classic scoping issue. The element is nuked in the DOM and recreated on selecting from a dropdown. |
Looking at the Unless you have a plunker that I can debug with, it's a little hard to help you more... |
I solved half the problem by creating a I'll put together a Plunker and get back with you. This is a spidery demo I'm putting together and I'm a total Angular noob so I'm struggling, for sure. Thanks! |
Have you tried defining the Isolated Scope like I mentioned in my first reply. If you didn't then you seriously should. |
Here's the plunker for the intramodal problem I'm experiencing. Again, it is testing the range just fine (0-9999.99) but not the Regex as you said. |
I'm not sure about your problems but what I noticed so far is that you are showing the result with a binding just over each input with |
On that thought, I have changed it to |
I had problems with that too at the beginning, I even blocked character input so that it doesn't influence the validation but at the end I removed that character blocking because it caused other indirect problems. So if that fixes your problem, you could close the issue... and if you like my Angular-Validation, you could click on the Star on top (if you haven't already done so). |
There is a ... I also tried removing ... Also tried moving the |
is this still a problem, did you find a resolution? Can I close the issue? |
I wouldn't call it "solved" but the workaround is changing from |
I'll see if I can look at it later on, but I don't currently have the time right now since I'm working on implementing validation for external 3rd party addons (like At least you have a workaround for the time being. |
Note: I don't know if you had time to read the 2 messages I sent a day before, but I deleted them from the thread since they were wrong information. Scrap all that, I found the problem. It's multiple factors that comes into play. Let's analyze all that. 1- Reading the AngularJS documentation 2- Also, you did not make the validation as required validation="numeric|between_num:0,9999.99" 3- [A] Which mean that if you take Step1 into effect (it returns undefined or empty) and you add up Step2 (value not required) and Step3 (Valid if empty + non-required) = Field is Valid ... and there you go. So the end of the story is, because of HTML5 browser if the user types in invalid characters, let say "2.5.aaa" (in Firefox you can, but Chrome seems to block that) it will make the value as I would basically suggest you use the Suggestion? |
Sorry, just been busy. My parents are having their 40th anniversary so I'm putting together a slideshow and editing a video together, I'm launching a startup, we're moving into a house, and I'm trying to keep my dayjob happy. :)
I could write something to stick the default back in if you blank it out but that seems like overkill and might interfere with your validation.
Does That would be cool because then it would pass validation. Something like:
I'm uncertain how well this would work with Best, -s |
Wow that is we call quite busy, hope you have time to sleep in between... Now to resume some of your questions/answers
<input ... validation="numeric|{{ isRequired }}" />
|
- Added sanitize to the demo page - Fixed issue #69, display proper error message when user type invalid chars on an input[number]
After some code refactoring, I found the proper way to trigger bad input on an So your original issue is now fixed, for anything else, please open another one. Thanks for your feedback, it helped making the library better :) |
You're welcome and thanks for your hard work on this! |
If you enter invalid
numeric
values like "3.1.5" and "32.e.e3" then no error is shown.The text was updated successfully, but these errors were encountered: