File: 2b-test03.html

package info (click to toggle)
libcgi-formbuilder-perl 3.03.01-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 960 kB
  • ctags: 250
  • sloc: perl: 5,116; makefile: 7; sh: 7
file content (53 lines) | stat: -rw-r--r-- 2,110 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<html>
<title>User Info</title>
Please update your info and hit "Submit".
<script type="text/javascript"><!-- hide from old browsers
function validate (form) {
    var alertstr = '';
    var invalid  = 0;

    // sex: radio group or multiple checkboxes
    var sex = null;
    var selected_sex = 0;
    for (var loop = 0; loop < form.elements['sex'].length; loop++) {
        if (form.elements['sex'][loop].checked) {
            sex = form.elements['sex'][loop].value;
            selected_sex++;
            if (sex == null || (sex != '1' && sex != '3' && sex != '5')) {
                alertstr += '- Choose one of the "glass EYE fucker" options\n';
                invalid++;
            }
        } // if
    } // for sex
    if (! selected_sex) {
        alertstr += '- Choose one of the "glass EYE fucker" options\n';
        invalid++;
    }

    if (invalid > 0 || alertstr != '') {
        if (! invalid) invalid = 'The following';   // catch for programmer error
        alert(''+invalid+' error(s) were encountered with your submission:'+'\n\n'
                +alertstr+'\n'+'Please correct these fields and try again.');
        // reset counters
        alertstr = '';
        invalid  = 0;
        return false;
    }
    return true;  // all checked ok
}
//-->
</script>
<p>
<form action="TEST" method="get" onsubmit="return validate(this);"><input id="_submitted" name="_submitted" type="hidden" value="1" />
Enter your name: <input id="name" name="name" type="text" />
Select your Color: <select name="color" multiple>
  <b><option VALUE="red">1</option></b>
  <b><option VALUE="blue">2</option></b>
  <b><option VALUE="yellow">3</option></b>
  <b><option VALUE="pink">4</option></b>

</select>
glass EYE fucker = <radio name="sex" value="1">2<br><radio name="sex" value="3">4<br><radio name="sex" value="5">6<br>
FYI, your dress size is (unknown)<br>
<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" />
</form>