YaWK  24.1
Yet another WebKit
signup.js
Go to the documentation of this file.
1 /*
2  * signup.js
3  * jquery validation plugin based form validation
4  *
5  * */
6 $(document).ready(function () {
7 
8  // RUN AJAX TIMER
9  initTimer();
10 
11  // set a timeout so that ajax calls will be delayed
12  function initTimer(){
13  var myTimer = 0;
14  $("#form").on('keydown', function() {
15  // cancel any previously-set timer
16  if (myTimer) {
17  clearTimeout(myTimer);
18  }
19 
20  myTimer = setTimeout(function() {
21  // call validation settings
22  checkForm();
23  }, 200); //delay time in milliseconds
24  });
25  }
26 
27  function checkForm(){
28  $('#form').validate({ // initialize the plugin
29  errorPlacement: function(error, element) {
30  error.insertBefore(element);
31  },
32  rules: {
33  gid: {
34  required: true
35  },
36  username: {
37  required: true,
38  minlength: 4,
39  maxlength: 48,
40  remote: {
41  url: "system/plugins/signup/js/check-username.php",
42  type: "post"
43  }
44  },
45  email: {
46  required: true,
47  email: true,
48  maxlength: 128,
49  remote: {
50  url: "system/plugins/signup/js/check-emailBooking.php",
51  type: "post"
52  }
53  },
54  password1: {
55  required: true,
56  minlength: 4,
57  maxlength: 48
58  },
59  password2: {
60  required: true,
61  minlength: 4,
62  maxlength: 48,
63  equalTo: "#password1"
64  },
65  checkTerms: {
66  required: true
67  },
68  firstname: {
69  required: true
70  },
71  lastname: {
72  required: true,
73  minlength: 2
74  },
75  street: {
76  required: true
77  },
78  zipcode: {
79  required: true,
80  number: true,
81  minlength: 2,
82  maxlength: 10
83  },
84  city: {
85  required: true,
86  minlength: 2
87  },
88  country: {
89  required: true,
90  minlength: 2
91  },
92  newUsername: {
93  minlength: 4,
94  maxlength: 48,
95  remote: {
96  url: "system/plugins/signup/js/check-username.php",
97  type: "post"
98  }
99  },
100  newEmail: {
101  email: true,
102  maxlength: 128,
103  remote: {
104  url: "system/plugins/signup/js/check-emailChange.php",
105  type: "post"
106  }
107 
108  },
109  newPassword1: {
110  minlength: 4,
111  maxlength: 48
112  },
113  newPassword2: {
114  minlength: 4,
115  maxlength: 48,
116  equalTo: "#newPassword1"
117  },
118  newFirstname: {
119  minlength: 2
120  },
121  newLastname: {
122  minlength: 2
123  },
124  newStreet: {
125  minlength: 2
126  },
127  newZipcode: {
128  minlength: 2,
129  maxlength: 10
130  },
131  newCity: {
132  minlength: 2
133  },
134  newCountry: {
135  minlength: 2
136  },
137  newUrl: {
138  minlength: 5
139  },
140  newTwitter: {
141  url: true,
142  minlength: 2
143  },
144  newFacebook: {
145  url: true,
146  minlength: 2
147  }
148  },
149  messages: {
150  username: {
151  remote: "Please select another username.  "
152  },
153  email: {
154  remote: "Have you received an invitation? If not, you are not allowed to signup / login here.  "
155  },
156  firstname: {
157  remote: "Please enter your name.  "
158  },
159  zipcode: {
160  number: "Please enter a valid zip code.  "
161  },
162  password2: {
163  equalTo: "Passwords do not match.  "
164  },
165  newEmail: {
166  remote: "Please use another email address.  "
167  },
168  newPassword2: {
169  equalTo: "Passwords do not match.  "
170  },
171  newUsername: {
172  equalTo: "Please select another username  "
173  }
174  }
175  });
176  }
177 
178  /*
179  * function on select set legend (text) in frontend beneath the form
180  */
181  $('#1_hidden').hide();
182  $('#2_hidden').hide();
183  $('#3_hidden').hide();
184  $('#4_hidden').hide();
185  $('#5_hidden').hide();
186  $('#gid').change(function(){
187  // gid 0
188  if($('#gid').val() == '0') {
189  $('#0_hidden').fadeIn();
190  } else {
191  $('#0_hidden').hide();
192  $('#1_hidden').hide();
193  $('#2_hidden').hide();
194  $('#3_hidden').hide();
195  $('#4_hidden').hide();
196  $('#5_hidden').hide();
197  }
198  // gid 5
199  if($('#gid').val() == '5') {
200  $('#5_hidden').fadeIn();
201  }
202  // gid 4
203  if($('#gid').val() == '4') {
204  $('#4_hidden').fadeIn();
205  }
206  // gid 3
207  if($('#gid').val() == '3') {
208  $('#3_hidden').fadeIn();
209  }
210  // gid 2
211  if($('#gid').val() == '2') {
212  $('#2_hidden').fadeIn();
213  }
214  // gid 1
215  if($('#gid').val() == '1') {
216  $('#1_hidden').fadeIn();
217  }
218  });
219 /* end document ready */
220 });
$blog gid
Definition: blog-setup.php:139
FuckAdBlock prototype on
Definition: fuckAdBlock.js:227
c jPlayer error
type
Definition: menu-new.php:35
document ready(function() { initTimer();function initTimer(){ var myTimer=0;$("#form").on('keydown', function() { if(myTimer) { clearTimeout(myTimer);} myTimer=setTimeout(function() { checkForm();}, 200);});} function checkForm(){ $('#form').validate({ errorPlacement:function(error, element) { error.insertBefore(element);}, rules:{ gid:{ required:true }, username:{ required:true, minlength:4, maxlength:48, remote:{ url:"system/plugins/signup/js/check-username.php", type:"post" } }, email:{ required:true, email:true, maxlength:128, remote:{ url:"system/plugins/signup/js/check-emailBooking.php", type:"post" } }, password1:{ required:true, minlength:4, maxlength:48 }, password2:{ required:true, minlength:4, maxlength:48, equalTo:"#password1" }, checkTerms:{ required:true }, firstname:{ required:true }, lastname:{ required:true, minlength:2 }, street:{ required:true }, zipcode:{ required:true, number:true, minlength:2, maxlength:10 }, city:{ required:true, minlength:2 }, country:{ required:true, minlength:2 }, newUsername:{ minlength:4, maxlength:48, remote:{ url:"system/plugins/signup/js/check-username.php", type:"post" } }, newEmail:{ email:true, maxlength:128, remote:{ url:"system/plugins/signup/js/check-emailChange.php", type:"post" } }, newPassword1:{ minlength:4, maxlength:48 }, newPassword2:{ minlength:4, maxlength:48, equalTo:"#newPassword1" }, newFirstname:{ minlength:2 }, newLastname:{ minlength:2 }, newStreet:{ minlength:2 }, newZipcode:{ minlength:2, maxlength:10 }, newCity:{ minlength:2 }, newCountry:{ minlength:2 }, newUrl:{ minlength:5 }, newTwitter:{ url:true, minlength:2 }, newFacebook:{ url:true, minlength:2 } }, messages:{ username:{ remote:"Please select another username.  " }, email:{ remote:"Have you received an invitation? If not, you are not allowed to signup / login here.  " }, firstname:{ remote:"Please enter your name.  " }, zipcode:{ number:"Please enter a valid zip code.  " }, password2:{ equalTo:"Passwords do not match.  " }, newEmail:{ remote:"Please use another email address.  " }, newPassword2:{ equalTo:"Passwords do not match.  " }, newUsername:{ equalTo:"Please select another username  " } } });} $('#1_hidden').hide();$('#2_hidden').hide();$('#3_hidden').hide();$('#4_hidden').hide();$('#5_hidden').hide();$('#gid').change(function(){ if($('#gid').val()=='0') { $('#0_hidden').fadeIn();} else { $('#0_hidden').hide();$('#1_hidden').hide();$('#2_hidden').hide();$('#3_hidden').hide();$('#4_hidden').hide();$('#5_hidden').hide();} if($('#gid').val()=='5') { $('#5_hidden').fadeIn();} if($('#gid').val()=='4') { $('#4_hidden').fadeIn();} if($('#gid').val()=='3') { $('#3_hidden').fadeIn();} if($('#gid').val()=='2') { $('#2_hidden').fadeIn();} if($('#gid').val()=='1') { $('#1_hidden').fadeIn();} });})