1// JavaScript Document 2 3//Wizard Init 4//FOR WIZARD AND VALIDATIONS 5 6$(document).ready(function () { 7 'use strict'; 8 9 //defining form 10 var form = $("#example-form").show(); 11 12 13 form.validate({ 14 ignore: ".ignore", 15 focusInvalid: true, 16 17 errorPlacement: function errorPlacement(error, element) { 18 return false; 19 }, 20 21 //error message block 22 showErrors: function (errorMap, errorList) { 23 $("#wizard").find("input").each(function () { 24 $(this).removeClass("error"); 25 }); 26 $(".errorblock").html(""); 27 if (errorList.length) { 28 $(".errorblock").html(errorList[0]['message']); 29 $(errorList[0]['element']).addClass("error"); 30 } 31 }, 32 33 //rules for validation 34 rules: { 35 confirm: { 36 equalTo: "#password" 37 }, 38 recomm: { 39 required: true, 40 }, 41 ref: { 42 required: true, 43 }, 44 service: { 45 required: true, 46 }, 47 like: { 48 required: true, 49 }, 50 51 }, 52 53 //message for validation 54 messages: { 55 "email": { 56 required: "Email is required", 57 email: "Invalid email" 58 }, 59 "sname": { 60 required: "Student Name required" 61 }, 62 "pname": { 63 required: "Parent Name required" 64 }, 65 "address": { 66 required: "address is required" 67 }, 68 "pnumber": { 69 required: "Phone No. required", 70 }, 71 72 }, 73 74 }); 75 76 //wizard steps 77 form.children("div").steps({ 78 headerTag: "h3", 79 bodyTag: "section", 80 titleTemplate: '<span class="uneek-indicator"></span><h6 class="sr-only">#title#</h6>', 81 transitionEffect: "fade", 82 enableAllSteps: true, 83 transitionEffectSpeed: 500, 84 85 //labels 86 labels: { 87 finish: "Submit", 88 next: "Next", 89 previous: "Back", 90 }, 91 92 //while changing step 93 onStepChanging: function (event, currentIndex, newIndex) { 94 95 // Allways allow previous action even if the current form is not valid! 96 if (currentIndex > newIndex) { 97 return true; 98 } 99 100 form.validate().settings.ignore = ":disabled,:hidden"; 101 return form.valid(); 102 103 }, 104 105 //while finishing 106 onFinishing: function (event, currentIndex) { 107 return form.valid(); 108 }, 109 110 //when finished 111 onFinished: function (event, currentIndex) { 112 113 $("#example-form").on("submit", function (e) { 114 //send data through ajax 115 e.preventDefault(); 116 return false; 117 }); 118 119 //Ajax Example 120 var field1 = $('#email').val(); //taking values from firstname input 121 var field2 = $('#sname').val(); 122 var field3 = $('#grade').val(); 123 var field4 = $('#pname').val(); 124 var field5 = $('#address').val(); 125 var field6 = $('#pnumber').val(); 126 var field7 = $('#comments').val(); 127 var field8 = $('#haboutus').find(":selected").text(); 128 129 $.ajax({ 130 //Google form url : check documentation 131 url: "https://docs.google.com/forms/u/1/d/e/1FAIpQLSfyJxZ-odmVkJnUa5CHPxh5bNFZQC5giRvtgC_F0k77O8HwRA/formResponse?", 132 data: { 133 //for getting entry.number : check documentation 134 "entry.402410663": field1, 135 "entry.80530356": field2, 136 "entry.1306600074": field3, 137 "entry.167258252": field4, 138 "entry.73075110": field5, 139 "entry.246679570": field6, 140 "entry.1508986024": field7, 141 "entry.691234031": field8, 142 }, 143 type: "POST", 144 dataType: "xml", 145 success: function (data) {}, 146 147 }); 148 149 //On submit 150 alert("Form Submitted!"); 151 $('#example-form')[0].reset(); 152 $("#wizard").steps('reset'); 153 154 } 155 156 }); 157 158 159})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.