JQuery Validation Issues

JQuery Validation Issues

Having issues getting jquery validation to work, any help would be greatly appreciated!

HTML
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title> Form Scrape </title>
  6.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  7.     <script src="validation/dist/jquery.validate.js"></script>
  8.     <link href="theme/jquery-ui.css" rel="stylesheet">
  9.     <link href = "css/formPrototype.css" rel="stylesheet">
  10.     <script src="theme/jquery-ui.js"> </script>
  11.     <script src="js/formValidation1.js"> </script>
  12. </head>
  13. <body>
  14. <div id = "userForm">
  15. <div id = "tabs">
  16.      <ul> 
  17.         <li><a href = "#userInfo"> Your Information </a> </li>
  18.             <li><a href = "#eventInfo"> Event Information </a> </li>
  19.         </ul>
  20.         <div id = "userInfo">
  21.         <form id = "1"> 
  22.         <span> Name </span> <br /><input type="text" id = "userName" required autofocus> <br />
  23.             <span> City </span>  <br /> <input type="text" id = "userCity"> <br />
  24.             <span> Phone Number </span> <br /> <input type="tel" id = "userPhone" required> <br />
  25.             <span> Email </span> <br /> <input type="email" id = "userEmail" required> <br />
  26.             <input type="checkbox" id = "emailCheck" value = "Yes"> Is it okay for Prestige to email you? <br /> <br />
  27.             <span> Company (If Applicable) </span> <br /> <input type="text" id = "userCompany"> <br /> <br />
  28.            
  29.             <span> Password </span> <br /> <input type="password" id = "userPassword" required> <br />
  30.             <span> Verify Password </span> <br /> <input type="password" id = "userPasswordVerify" required> <br />
  31.         </form>
  32.         </div>
  33.         <div id = "eventInfo"> 
  34.          <form id = "2">
  35.         <span> Type of Event </span> <br />
  36.    
  37.                 <input type="radio" name = "eventType" value = "Wedding" class="radioButton"> Wedding <br />
  38.                 <input type="radio" name = "eventType" value = "Party" class = "radioButton"> Party <br />
  39.                 <input type="radio" name = "eventType" value = "Banquet" class = "radioButton"> Banquet <br />
  40.                 <input type="radio" name = "eventType" value = "Birthday" class = "radioButton"> Birthday <br />
  41.                 <input type="radio" name = "eventType" value = "WorkEvent" class = "radioButton"> Work Event <br />
  42.                 <input type="radio" name = "eventType" value = "Other" class = "radioButton"> Other <input type="text" id = "other"> <br /> <br />
  43.                    
  44.                 <span> Date of Event </span> <br />
  45.                 <input type= "text" id = "eventDate" class="datepicker" required> <br /> <br />
  46.                 
  47.                 <label for = "genre"> Genre of Music</label>
  48.                 <select name = "genre" id = "genre">
  49.                 <option>Rock</option>
  50.                     <option>Country</option>
  51.                     <option>Pop</option>
  52.                     <option>Jazz</option>
  53.                     <option>Blues</option>
  54.                     <option>Folk</option>
  55.                     <option>Alternative</option>
  56.                     <option>Swing</option>
  57.                     <option>Reggae</option>
  58.                     <option>Electronic</option>
  59.                     <option>Hip-Hop</option>
  60.                     <option> R&B </option>
  61.                 </select>
  62.                 <br />
  63.                 
  64.                 <p>
  65.                 <label for="budget">What is your budget? </label>
  66.   <input id="budget" name="budget" required>
  67.                 </p>
  68.             </form>
  69.              <button type="submit" id="submit"> Submit </button>
  70.             <button type="button" id="reset"> Reset </button>      
  71.         </div>
  72. </div>
  73.  <div id = "output"></div>
  74. </div>
  75. </body>
  76. </html>
Javascript
  1. // JavaScript Document
  2. $(document).ready(function() {

  3. $('form').each(function () {
  4.     $(this).validate();
  5. });
  6. $( "#accordion" ).accordion();

  7. $( "button" ).button();

  8. $( "#button-icon" ).button({
  9. icon: "ui-icon-gear",
  10. showLabel: false
  11. });

  12. $( "#radioset" ).buttonset();

  13. $( "#controlgroup" ).controlgroup();

  14. $( "#tabs" ).tabs();

  15. $( ".datepicker" ).datepicker({
  16. inline: true
  17. });

  18. $( "#spinner" ).spinner();

  19. $( "#budget" ).spinner({
  20. step: 250
  21. });

  22. $( "#budget" ).spinner("value", 1000);

  23. $( "#menu" ).menu();

  24. $( "#tooltip" ).tooltip();

  25. $( "#selectmenu" ).selectmenu();

  26. $("#genre").selectmenu();

  27. $("#reset").click (function () {
  28. $('#1')[0].reset();
  29. $('#2')[0].reset();
  30. $('#output').html('');
  31. });

  32. $('#submit').click (function () {

  33. //Need to get all input and store in variables to then be ouput to the output div
  34. var userName = $('#userName').val();
  35. var userCity = $('#userCity').val ();
  36. var userPhone = $('#userPhone').val ();
  37. var userEmail = $('#userEmail').val ();
  38. var canEmail = $('input[id = emailCheck]:checked').val();
  39. var canEmailOutput = 'null';
  40. if (canEmail === 'Yes') {
  41. canEmailOutput = 'Yes';
  42. }
  43. else {
  44. canEmailOutput = 'No';
  45. }
  46. var userCompany = $('#userCompany').val ();
  47. var userPassword = $('#userPassword').val ();
  48. var userPasswordVerify = $('#userPasswordVerify').val();
  49. var eventType = $('input[name=eventType]:checked').val();
  50. var eventTypeOutput = 'null';
  51. if (eventType === "Other") {
  52. eventTypeOutput = $('#other').val();
  53. }
  54. else {
  55. eventTypeOutput = eventType;
  56. }
  57. var eventDate = $('#eventDate').val();
  58. var genre = $('#genre').val ();
  59. var budget = $('#budget').val();
  60. $('#output').html('Name: ' + userName + '<br />' +
  61.                 'City: ' + userCity + '<br />' +
  62. 'Phone: ' + userPhone + '<br />' +
  63. 'Email: ' + userEmail + '<br />' +
  64. 'Okay to Email?: ' + canEmailOutput + '<br />' +
  65. 'Company: ' + userCompany + '<br />' +
  66. 'Password: ' + userPassword + '<br />' +
  67. 'Password Verification: ' + userPasswordVerify + '<br />' +
  68. 'Event Type: ' + eventTypeOutput + '<br />' +
  69. 'Event Date: ' + eventDate + '<br />' +
  70. 'Genre: ' + genre + '<br />' +
  71. 'Budget: ' + budget + '<br />'
  72. );
  73.  
  74. return false;
  75. });

  76. // Hover states on the static widgets
  77. $( "#dialog-link, #icons li" ).hover(
  78. function() {
  79. $( this ).addClass( "ui-state-hover" );
  80. },
  81. function() {
  82. $( this ).removeClass( "ui-state-hover" );
  83. }
  84. );

  85. });