var $reportNameField = $('[data-js="report-name-field"]');
$reportNameField.on('blur', function(){
var self = $(this);
var value = self.val();
var message = self.attr('title');
if(value.length && !self[0].checkValidity()) { //checkValidity is native JS (so we need the dom element inside jquery selector) and refers to html5 'pattern' attribute
self.parent().addClass('has-error'); //add class to form-group
self.next().text(message); //fill the <span> help-block with the validation text
} else {
self.parent().removeClass('has-error');
self.next().empty();
}
});