function validateForm() {
var form = document.contact_form; // по имени
var elements = form.querySelectorAll('.form_control');
form.addEventListener('submit', validForm, false);
function validForm(event) {
var valid = true,
border = '';
if (form.username.value == '') {
border = '2px solid red';
valid = false;
}
form.username.style.border = border;
border = '';
if (form.email.value == '') {
border = '2px solid red';
valid = false;
}
form.email.style.border = border;
if (!valid) {
event.preventDefault();
}
}
}