srkirkland / DataAnnotationsExtensions

Validation extensions for DataAnnotations, including optional MVC client validation implementations
https://dataannotationsextensions.apphb.com/
BSD 3-Clause "New" or "Revised" License
308 stars 86 forks source link

Have UrlAttribute not require input #50

Closed scottksmith95 closed 12 years ago

scottksmith95 commented 12 years ago

I have a case where I want to validate input to make sure it is a valid Url, but if nothing is entered, I want it to pass validation.

srkirkland commented 12 years ago

This is the default behavior-- an empty URL should pass validation (additionally, an empty field should pass any validation other than "required"). Make sure you don't also have [Required] on the field (look for the required or data-val-required attributes on the input box)