Subversion Repositories DevTools

Rev

Rev 3892 | Rev 3895 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3892 Rev 3894
Line 68... Line 68...
68
 
68
 
69
function MM_validateForm() { //v5.0
69
function MM_validateForm() { //v5.0
70
   var ii,p,pl,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
70
   var ii,p,pl,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
71
   var REresults;
71
   var REresults;
72
   var pass,passc;
72
   var pass,passc;
73
   var noAlert = false;
73
   var showAlert = true;
74
 
74
 
75
   // Other general validations
75
   // Other general validations
76
   var cleanStrRE = /^[0-9a-z_\.\(\)\-]+$/i;
76
   var cleanStrRE = /^[0-9a-z_\.\(\)\-]+$/i;
77
   var pkgRE = /^[a-z][a-z0-9_-]*[a-z0-9]$/i;
77
   var pkgRE = /^[a-z][a-z0-9_-]*[a-z0-9]$/i;
78
   var versionRE = /^[0-9a-z_\.\(\)\-]+$/i;
78
   var versionRE = /^[0-9a-z_\.\(\)\-]+$/i;
Line 81... Line 81...
81
   var urlRE = "^https?://[a-z1-9]";
81
   var urlRE = "^https?://[a-z1-9]";
82
   //character range disallowed
82
   //character range disallowed
83
   var HTMLchr = /[\<\>\'\"]+/i;
83
   var HTMLchr = /[\<\>\'\"]+/i;
84
   var alphanumRE = /^[a-z0-9]+$/i;
84
   var alphanumRE = /^[a-z0-9]+$/i;
85
 
85
 
-
 
86
   // Options are first
-
 
87
   for (ii=0; ii<(args.length-2) && args[ii].indexOf('--') == 0; ii++) {
-
 
88
    switch(args[ii].toLowerCase()) {
-
 
89
      case "--silent" :
-
 
90
        showAlert = false;
-
 
91
        break;
-
 
92
    }
-
 
93
  }
-
 
94
 
-
 
95
  // Iterate of arguments
-
 
96
  // These are in triplets
-
 
97
  //    Name of form object
-
 
98
  //    Text Prefix for error
-
 
99
  //    Type of Test to Perform
86
   for (ii=0; ii<(args.length-2); ii+=3) {
100
   for (; ii<(args.length-2); ii+=3) {
87
      test=args[ii+2];
101
      test=args[ii+2];
88
      val=MM_findObj(args[ii]);
102
      val=MM_findObj(args[ii]);
89
 
103
 
90
      if (val) {
104
      if (val) {
91
         nm=args[ii+1];
105
         nm=args[ii+1];
92
         val=val.value;
106
         val=val.value;
93
 
107
 
94
 
-
 
95
 
-
 
96
         if (val!="") {
108
         if (val!="") {
97
            if (test.indexOf('isEmail')!=-1) {
109
            if (test.indexOf('isEmail')!=-1) {
98
               p=val.indexOf('@');
110
               p=val.indexOf('@');
99
               if (p<1 || p==(val.length-1) || test.charAt(0) == '@') errors+='- '+nm+' must contain an e-mail address.\n';
111
               if (p<1 || p==(val.length-1) || test.charAt(0) == '@') errors+='- '+nm+' must contain an e-mail address.\n';
100
            }
112
            }
Line 294... Line 306...
294
            if (MM_findObj('FRdomainauth').checked) {
306
            if (MM_findObj('FRdomainauth').checked) {
295
               if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';
307
               if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';
296
            }
308
            }
297
         }
309
         }
298
      }
310
      }
299
 
-
 
300
      if (test.indexOf('Silent')!=-1) {
-
 
301
        noAlert = true;
-
 
302
      }
-
 
303
      
-
 
304
   }
311
   }
305
 
312
 
306
   if (errors) {
313
   if (errors) {
307
      if ( ! noAlert ) alert('The following error(s) occurred:\n\n'+errors);
314
      if ( showAlert ) alert('The following error(s) occurred:\n\n'+errors);
308
      clickedButton=false;
315
      clickedButton=false;
309
   } else {
316
   } else {
310
      clickedButton=true;
317
      clickedButton=true;
311
   }
318
   }
312
   document.MM_returnValue = (errors == '');
319
   document.MM_returnValue = (errors == '');
313
   document.MM_error = errors;
320
   document.MM_error = errors;
314
 
321
 
315
   if (MM_findObj('ProgressBar') && document.MM_returnValue && !noAlert)
322
   if (MM_findObj('ProgressBar') && document.MM_returnValue && showAlert)
316
      MM_findObj('ProgressBar').style.visibility='visible';
323
      MM_findObj('ProgressBar').style.visibility='visible';
317
}
324
}
318
 
325
 
319
function isChecked(boxName, buttonId) {
326
function isChecked(boxName, buttonId) {
320
  var formButton = document.getElementById(buttonId);
327
  var formButton = document.getElementById(buttonId);