$(function() {
  $("#registrationForm").submit(function (event) {
    if (!$(this.name).val()) {
      $(this.name).parents("div.required").addClass("error");
      event.preventDefault();
    }
    if (!$("input[name='gender']:checked", this).length) {
      $("input[name='gender']", this).parents("div.required").addClass("error");
      event.preventDefault();
    }
  });
});
