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

« back to all changes in this revision

Viewing changes to t/3a-test06.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:
2
2
function validate (form) {
3
3
    var alertstr = '';
4
4
    var invalid  = 0;
 
5
    var invalid_fields = new Array();
5
6
 
6
7
    // ticket: standard text, hidden, password, or textarea box
7
8
    var ticket = form.elements['ticket'].value;
8
9
    if (ticket == null || ! ticket.match(/^\d+$/)) {
9
10
        alertstr += '- Invalid entry for the "Ticket" field\n';
10
11
        invalid++;
 
12
        invalid_fields.push('ticket');
11
13
    }
12
14
    if (invalid > 0 || alertstr != '') {
13
15
        if (! invalid) invalid = 'The following';   // catch for programmer error
14
16
        alert(''+invalid+' error(s) were encountered with your submission:'+'\n\n'
15
17
                +alertstr+'\n'+'Please correct these fields and try again.');
16
 
        // reset counters
17
 
        alertstr = '';
18
 
        invalid  = 0;
19
18
        return false;
20
19
    }
21
20
    return true;  // all checked ok
25
24
<noscript><font color="#cc0000"><b>Please enable Javascript or use a newer browser.</b></font></noscript>
26
25
<p>Fields that are <b>highlighted</b> are required.</p>
27
26
<form action="TEST" method="post" onsubmit="return validate(this);">
28
 
<div>
29
 
<input id="_submitted" name="_submitted" type="hidden" value="1" /><input id="replacement" name="replacement" type="hidden" value="TRUE" />
 
27
<div><input id="_submitted" name="_submitted" type="hidden" value="1" /></div>
 
28
<div><input id="replacement" name="replacement" type="hidden" value="TRUE" />
30
29
<input id="action" name="action" type="hidden" value="Unsubscribe" />
31
30
<input id="name" name="name" type="hidden" value="Pete Peteson" />
32
31
<input id="email" name="email" type="hidden" value="pete@peteson.com" />
33
 
<input id="extra" name="extra" type="hidden" value="junk" />
 
32
<input id="extra" name="extra" type="hidden" value="junk" /></div>
34
33
<table>
35
34
<tr valign="top">
36
35
  <td><b>Ticket</b></td>
48
47
  <td align="center" colspan="2"><input id="_submit" name="_submit" onclick="this.form._submit.value = this.value;" type="submit" value="Update" /><input id="_submit_2" name="_submit" onclick="this.form._submit.value = this.value;" type="submit" value="Delete" /><input id="_submit_3" name="_submit" onclick="this.form._submit.value = this.value;" type="submit" value="Cancel" /></td>
49
48
</tr>
50
49
</table>
51
 
</div>
52
50
</form>