File: 2e-test01.html

package info (click to toggle)
libcgi-formbuilder-perl 3.08-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,204 kB
  • sloc: perl: 7,201; makefile: 13
file content (32 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download | duplicates (5)
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
<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;
    var invalid_fields = new Array();

    // name: standard text, hidden, password, or textarea box
    var name = form.elements['name'].value;
    if (name == null || ! name.match(/^[a-zA-Z]+$/)) {
        alertstr += '- Invalid entry for the "Name" field\n';
        invalid++;
        invalid_fields.push('name');
    }
    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.');
        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" />
FYI, your dress size is 42<br>
<input id="_reset" name="_reset" type="reset" value="No esta una button del submito" /> 
</form>