jqBootstrapValidation
jqBootstrapValidation copied to clipboard
url validators
i can't find validation for url i knew it can be done using regex validation but i think it should have the url rule
Good idea. I'm working on the documentation currently so I can't add it right now, but I'll mark it as an enhancement request for later.
Did you find a suitable regex? if not, this one was recommended on stackoverflow:
(http[s]?:\/\/){0,1}(www\.){0,1}[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,5}[\.]{0,1}
and this one on nettuts:
(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?
but I haven't had chance to test them out.
I also think that's a great idea. Here is the code I used in the meantime.
<div class="form-group control-group">
<label for="website">Website</label>
<input type="url" class="form-control" id="website" name="website"
data-validation-regex-regex="(http[s]?:\/\/){0,1}(www\.){0,1}[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,5}[\.]{0,1}"
data-validation-regex-message="Please enter a valid URL" />
<p class="help-block"></p>
</div>