~ubuntu-branches/ubuntu/intrepid/libcgi-formbuilder-perl/intrepid

« back to all changes in this revision

Viewing changes to t/3a-test10.html

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-28 20:29:04 UTC
  • mfrom: (2.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080628202904-81kzjon8e8silx88
Tags: 3.05.01-6
Set urgency=medium as 3.05.01-6 included a FTBFS bugfix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Content-type: text/html
 
2
 
1
3
<html>
2
4
<head>
3
5
<title>TEST</title>
5
7
function validate (form) {
6
8
    var alertstr = '';
7
9
    var invalid  = 0;
 
10
    var invalid_fields = new Array();
8
11
 
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';
13
16
        invalid++;
 
17
        invalid_fields.push('hostname');
14
18
    }
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';
19
23
        invalid++;
 
24
        invalid_fields.push('domain');
20
25
    }
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.');
25
 
        // reset counters
26
 
        alertstr = '';
27
 
        invalid  = 0;
28
30
        return false;
29
31
    }
30
32
    return true;  // all checked ok
37
39
<noscript><font color="#cc0000"><b>Please enable Javascript or use a newer browser.</b></font></noscript>
38
40
<p>Fields that are <b>highlighted</b> are required.</p>
39
41
<form action="TEST" method="get" onsubmit="return validate(this);">
40
 
<div>
41
 
<input id="_submitted" name="_submitted" type="hidden" value="1" /><input id="user" name="user" type="hidden" value="pete" />
42
 
<input id="ticket" name="ticket" type="hidden" value="111" />
 
42
<div><input id="_submitted" name="_submitted" type="hidden" value="1" /></div>
 
43
<div><input id="user" name="user" type="hidden" value="pete" />
 
44
<input id="ticket" name="ticket" type="hidden" value="111" /></div>
43
45
<table>
44
46
<tr valign="top">
45
47
  <td><b>Hostname</b></td>
53
55
  <td align="center" colspan="2"><input id="_submit" name="_submit" type="submit" value="Submit" /></td>
54
56
</tr>
55
57
</table>
56
 
</div>
57
58
</form>
58
59
</body>
59
60
</html>