Merge branch 'feature/warn-wrong-customized-url' into 'develop'

Warn when url has a wrong format

See merge request framasoft/framadate!311
This commit is contained in:
Thomas Citharel 2018-05-14 19:02:51 +02:00
commit f28198e497

View File

@ -39,6 +39,17 @@ $(document).ready(function () {
$("#use_customized_url").change(function () {
if ($(this).prop("checked")) {
$("#customized_url_options").removeClass("hidden");
// Check url pattern
$('#customized_url').on('input', function() {
var regex_url = /^[a-zA-Z0-9-]*$/
if (! regex_url.test(this.value)) {
$(this).parent(".input-group").addClass("has-error");
$(this).attr("aria-invalid", "true");
} else {
$(this).parent(".input-group").removeClass("has-error");
$(this).attr("aria-invalid", "false");
}
});
} else {
$("#customized_url_options").addClass("hidden");
}