<commit_before>Rubpocalypse.Views.Form = Backbone.View.extend({
  events: {
    "keyup input": "checkForCompletion",
    "change input": "checkForCompletion"
  },
  initialize: function() {
    this.checkForCompletion();
  },
  show: function() {
    $(this.el).addClass("visible");
  },
  checkForCompletion: function() {
    var submit = this.$(":submit");
    if (this.isComplete())
      submit.removeAttr("disabled");
    else
      submit.attr("disabled",true);
  },
  isComplete: function() {
    return false;
  }
});<commit_msg>Added the form validation and submit handler<commit_after>Rubpocalypse.Views.Form = Backbone.View.extend({
  emailPattern: /^(([^<>()\[\]\\.,;:\s@\"]+(\.[^<>()\[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
  events: {
    "keyup input": "checkForCompletion",
    "change input": "checkForCompletion",
    "submit form": "transmit"
  },
  initialize: function() {
    this.checkForCompletion();
  },
  show: function() {
    $(this.el).addClass("visible");
  },
  checkForCompletion: function() {
    var submit = this.$(":submit");
    if (this.isComplete())
      submit.removeAttr("disabled");
    else
      submit.attr("disabled",true);
  },
  isComplete: function() {
    return this.validCut() &&
           this.validSize() && 
           this.validName() &&
           this.validEmail();
  },
  validCut: function() {
    return this.$("input[name='cut']:checked").length;
  },
  validSize: function() {
    return this.$("input[name='size']:checked").length;
  },
  validName: function() {
    return $.trim(this.$("input[name='name']").val()).length;
  },
  validEmail: function() {
    return this.emailPattern.test($.trim(this.$("input[name='email']").val()));
  },
  transmit: function(e) {
    e.preventDefault();
    alert("TRANSMIT!");
  }
});
{'fraction_non_alphanumeric': 0.24091880341880342, 'fraction_numerical': 0.01014957264957265, 'mean_word_length': 3.417452830188679, 'pattern_counts': {'":': 7, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2607804', 'n_tokens_mistral': 648, 'n_tokens_neox': 635, 'n_words': 92}