-
Notifications
You must be signed in to change notification settings - Fork 58
Possible to use "or"? #98
Comments
Angular-Validation is looping through all Validators in sequence and they all need to be valid for the field to become valid itself. Basically there is currently no such thing as either "or" validator. In your case, it's probably best to use |
- Fixed issue #91 interpolation problem with remove validation doesn't work twice. - Enhancement #98 possibility to use one validation or another (tell how many Validators are required for field to become valid). - Enhancement #97 possibility to validate even on empty text field (useful on `custom` and `remote` validation). - Refined some Validators (IPV6 now include compressed/uncompressed addresses, added more Polish characters to other Validators)
Ok so I made a change and added your request into the latest release v1.4.18 You can now use a new attribute named <input type="text"
name="input2"
ng-model="input2"
validation="ipv4|ipv6"
valid-require-how-many="1" /> But please note that if you include the <input type="text"
name="input2"
ng-model="input2"
validation="ipv4|ipv6|required"
valid-require-how-many="2" /> You can see the new description inside the Wiki - Valid-Require-How-Many I also made the IPV6 Validator a bit better by refining the Regex pattern expression, it can now accept both compressed (by removing leading 0) & uncompressed IPV6 addresses. and don't forget to click on Star on top if you like and use the Angular-Validation package. Thanks :) |
Great explanation and works like a charm! Thank you! |
Hi!
I want to validate an IP address field as either IPv4 OR IPv6. Using the directive I tried validate="ipv4|ipv6" but this makes it so that the field has to be valid for IPv4 AND IPv6. Is this possible to do without writing a custom validation function?
The text was updated successfully, but these errors were encountered: