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

« back to all changes in this revision

Viewing changes to t/3a-test20.html

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2006-05-28 15:47:27 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20060528154727-u26u5nqd0btamxpm
Tags: 3.03.01-1
* New upstream release.
  + optgroups bugfix for complex arrays.
  + removal of HTML::Entities support due to utf8 issues. Closes:
    bug#338369 (thanks to Todd Charron <tcharron@badkarma.mine.nu> for
    reporting, and to several others for working on workarounds).
  + new es_ES Messages module with better translations
  + a patch from Mark Hedges to enable plugin modules for mailresults()
* Update local cdbs snippet copyright-check.mk:
  + Broaden scan to also look for "(c)" by default.
  + Make egrep options configurable.
* Bump up standards-version to 3.7.2 (no changes needed).
* Update debian/copyright_hints (nothing remarkable).
* Bump up debian/watch to version 3 syntax, and use uversionmangle
  instead of multiple parantheses (both work using uscan locally, but
  the later hopefully works with qa.debian.org too).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
<title>Finalize Your Order</title>
 
4
<script type="text/javascript"><!-- hide from old browsers
 
5
function validate_order (form) {
 
6
    var alertstr = '';
 
7
    var invalid  = 0;
 
8
 
 
9
    // skip validation if they clicked "Cancel"
 
10
    if (form._submit.value == 'Cancel') return true;
 
11
    // first_name: standard text, hidden, password, or textarea box
 
12
    var first_name = form.elements['first_name'].value;
 
13
    if (first_name == null || first_name === "") {
 
14
        alertstr += '- Enter shit in the "First Name" field\n';
 
15
        invalid++;
 
16
    }
 
17
    // last_name: standard text, hidden, password, or textarea box
 
18
    var last_name = form.elements['last_name'].value;
 
19
    if (last_name == null || last_name === "") {
 
20
        alertstr += '- Enter shit in the "Last Name" field\n';
 
21
        invalid++;
 
22
    }
 
23
    // email: standard text, hidden, password, or textarea box
 
24
    var email = form.elements['email'].value;
 
25
    if (email == null || ! email.match(/^[\w\-\+\._]+\@[a-zA-Z0-9][-a-zA-Z0-9\.]*\.[a-zA-Z]+$/)) {
 
26
        alertstr += '- Enter shit in the "Email" field\n';
 
27
        invalid++;
 
28
    }
 
29
    // send_me_emails: radio group or multiple checkboxes
 
30
    var send_me_emails = null;
 
31
    var selected_send_me_emails = 0;
 
32
    for (var loop = 0; loop < form.elements['send_me_emails'].length; loop++) {
 
33
        if (form.elements['send_me_emails'][loop].checked) {
 
34
            send_me_emails = form.elements['send_me_emails'][loop].value;
 
35
            selected_send_me_emails++;
 
36
            if (send_me_emails == null || send_me_emails === "") {
 
37
                alertstr += '- Choose one of the "Send Me Emails" options\n';
 
38
                invalid++;
 
39
            }
 
40
        } // if
 
41
    } // for send_me_emails
 
42
    if (! selected_send_me_emails) {
 
43
        alertstr += '- Choose one of the "Send Me Emails" options\n';
 
44
        invalid++;
 
45
    }
 
46
 
 
47
    // address: standard text, hidden, password, or textarea box
 
48
    var address = form.elements['address'].value;
 
49
    if (address == null || address === "") {
 
50
        alertstr += '- Enter shit in the "Address" field\n';
 
51
        invalid++;
 
52
    }
 
53
    // state: select list, always assume it's multiple to get all values
 
54
    var state = null;
 
55
    var selected_state = 0;
 
56
    for (var loop = 0; loop < form.elements['state'].options.length; loop++) {
 
57
        if (form.elements['state'].options[loop].selected) {
 
58
            state = form.elements['state'].options[loop].value;
 
59
            selected_state++;
 
60
            if (state == null || state === "") {
 
61
                alertstr += '- Select an option from the "State" list\n';
 
62
                invalid++;
 
63
            }
 
64
        } // if
 
65
    } // for state
 
66
    if (! selected_state) {
 
67
        alertstr += '- Select an option from the "State" list\n';
 
68
        invalid++;
 
69
    }
 
70
 
 
71
    // zipcode: standard text, hidden, password, or textarea box
 
72
    var zipcode = form.elements['zipcode'].value;
 
73
    if (zipcode == null || ! zipcode.match(/^\d{5}$|^\d{5}\-\d{4}$/)) {
 
74
        alertstr += '- Enter shit in the "Zipcode" field\n';
 
75
        invalid++;
 
76
    }
 
77
    // credit_card: standard text, hidden, password, or textarea box
 
78
    var credit_card = form.elements['credit_card'].value;
 
79
    if (credit_card == null || ! credit_card.match(/^\d{4}[\- ]?\d{4}[\- ]?\d{4}[\- ]?\d{4}$|^\d{4}[\- ]?\d{6}[\- ]?\d{5}$/)) {
 
80
        alertstr += '- Enter shit in the "Credit Card" field\n';
 
81
        invalid++;
 
82
    }
 
83
    // expiration: standard text, hidden, password, or textarea box
 
84
    var expiration = form.elements['expiration'].value;
 
85
    if (expiration == null || ! expiration.match(/^(0?[1-9]|1[0-2])\/?[0-9]{2}$/)) {
 
86
        alertstr += '- Enter shit in the "Expiration" field\n';
 
87
        invalid++;
 
88
    }
 
89
    if (invalid > 0 || alertstr != '') {
 
90
        if (! invalid) invalid = 'The following';   // catch for programmer error
 
91
        alert(''+invalid+' error(s) were encountered with your submission:'+'\n\n'
 
92
                +alertstr+'\n'+'Please correct these fields and try again.');
 
93
        // reset counters
 
94
        alertstr = '';
 
95
        invalid  = 0;
 
96
        return false;
 
97
    }
 
98
    return true;  // all checked ok
 
99
}
 
100
//-->
 
101
</script>
 
102
</head>
 
103
<body bgcolor="white">
 
104
<h3>Finalize Your Order</h3>
 
105
<noscript><font color="#cc0000"><b>Please enable Javascript or use a newer browser.</b></font></noscript>
 
106
<p>Don't fuck up it causes me work. Fuck try again ok?</p>
 
107
<form action="TEST" id="order" method="post" name="order" onsubmit="return validate_order(this);">
 
108
<div>
 
109
<input id="_submitted_order" name="_submitted_order" type="hidden" value="1" />
 
110
<table>
 
111
<tr id="order_first_name_row" valign="top">
 
112
  <td id="order_first_name_label"><b>First Name</b></td>
 
113
  <td id="order_first_name_field"><input id="first_name" name="first_name" type="text" /></td>
 
114
</tr>
 
115
<tr id="order_last_name_row" valign="top">
 
116
  <td id="order_last_name_label"><b>Last Name</b></td>
 
117
  <td id="order_last_name_field"><input id="last_name" name="last_name" type="text" /></td>
 
118
</tr>
 
119
<tr id="order_email_row" valign="top">
 
120
  <td id="order_email_label"><b>Email</b></td>
 
121
  <td id="order_email_field"><input id="email" name="email" type="text" value="pete@peteson.com" /></td>
 
122
</tr>
 
123
<tr id="order_send_me_emails_row" valign="top">
 
124
  <td id="order_send_me_emails_label"><b>Send Me Emails</b></td>
 
125
  <td id="order_send_me_emails_field"><table>
 
126
  <tr>
 
127
    <td><input id="send_me_emails_1" name="send_me_emails" type="radio" value="1" /></td>
 
128
    <td><label for="send_me_emails_1">Yes</label></td>
 
129
  </tr>
 
130
  <tr>
 
131
    <td><input checked="checked" id="send_me_emails_0" name="send_me_emails" type="radio" value="0" /></td>
 
132
    <td><label for="send_me_emails_0">No</label></td>
 
133
  </tr>
 
134
  </table></td>
 
135
</tr>
 
136
<tr id="order_address_row" valign="top">
 
137
  <td id="order_address_label"><b>Address</b></td>
 
138
  <td id="order_address_field"><input id="address" name="address" type="text" /></td>
 
139
</tr>
 
140
<tr id="order_state_row" valign="top">
 
141
  <td id="order_state_label"><b>State</b></td>
 
142
  <td id="order_state_field"><select id="state" name="state">
 
143
  <option value="">-select-</option>
 
144
  <option value="DJ">DJ</option>
 
145
  <option value="EE">EE</option>
 
146
  <option value="HI">HI</option>
 
147
  <option value="IW">IW</option>
 
148
  <option value="JS">JS</option>
 
149
  <option value="JS">JS</option>
 
150
  <option value="KS">KS</option>
 
151
  <option value="NK">NK</option>
 
152
  <option value="TY">TY</option>
 
153
  <option value="UR">UR</option>
 
154
  <option value="UW">UW</option>
 
155
  <option value="YK">YK</option>
 
156
  </select></td>
 
157
</tr>
 
158
<tr id="order_zipcode_row" valign="top">
 
159
  <td id="order_zipcode_label"><b>Zipcode</b></td>
 
160
  <td id="order_zipcode_field"><input id="zipcode" name="zipcode" type="text" /></td>
 
161
</tr>
 
162
<tr id="order_credit_card_row" valign="top">
 
163
  <td id="order_credit_card_label"><b>Credit Card</b></td>
 
164
  <td id="order_credit_card_field"><input id="credit_card" name="credit_card" type="text" /></td>
 
165
</tr>
 
166
<tr id="order_expiration_row" valign="top">
 
167
  <td id="order_expiration_label"><b>Expiration</b></td>
 
168
  <td id="order_expiration_field"><input id="expiration" name="expiration" type="text" /></td>
 
169
</tr>
 
170
<tr id="order_submit_row" valign="top">
 
171
  <td align="center" colspan="2" id="order_submit_field"><input id="order_submit" name="_submit" onclick="this.form._submit.value = this.value;" type="submit" value="Place Order" /><input id="order_submit_2" name="_submit" onclick="this.form._submit.value = this.value;" type="submit" value="Cancel" /></td>
 
172
</tr>
 
173
</table>
 
174
</div>
 
175
</form>
 
176
</body>
 
177
</html>