5
7
function validate (form) {
9
12
// hostname: standard text, hidden, password, or textarea box
10
13
var hostname = form.elements['hostname'].value;
11
14
if (hostname == null || ! hostname.match(/^[a-zA-Z0-9][-a-zA-Z0-9]*$/)) {
12
15
alertstr += '- Invalid entry for the "Hostname" field\n';
15
19
// domain: standard text, hidden, password, or textarea box
16
20
var domain = form.elements['domain'].value;
17
21
if (domain == null || ! domain.match(/^[a-zA-Z0-9][-a-zA-Z0-9\.]*\.[a-zA-Z]+$/)) {
18
22
alertstr += '- Invalid entry for the "Domain" field\n';
21
26
if (invalid > 0 || alertstr != '') {
22
27
if (! invalid) invalid = 'The following'; // catch for programmer error
23
28
alert(''+invalid+' error(s) were encountered with your submission:'+'\n\n'
24
29
+alertstr+'\n'+'Please correct these fields and try again.');
30
32
return true; // all checked ok