]> Dogcows Code - chaz/p5-CGI-Ex/blobdiff - lib/CGI/Ex/validate.js
CGI::Ex 2.04
[chaz/p5-CGI-Ex] / lib / CGI / Ex / validate.js
index a5014afef5d789226419a9055965a986d62f71ab..d8a62704c4bfdfe04b9ac0f212f0187d46e5fe94 100644 (file)
@@ -4,7 +4,7 @@
 *  Based upon CGI/Ex/Validate.pm v1.14 from Perl                     *
 *  For instructions on usage, see perldoc of CGI::Ex::Validate       *
 ***----------------------------------------------------------------**/
-// $Revision: 1.34 $
+// $Revision: 1.36 $
 
 function Validate () {
  this.error             = vob_error;
@@ -292,7 +292,8 @@ function vob_validate_buddy (form, field, field_val, N_level, ifs_match) {
    for (var i = 0; i < tests.length; i ++) {
      var el = form[field];
      var type = el.type;
-     if (type && (type == 'hidden' || type == 'password' || type == 'text' || type == 'textarea' || type == 'submit')) el.value = values[0] = field_val[tests[i]];
+     if (type && (type == 'hidden' || type == 'password' || type == 'text' || type == 'textarea' || type == 'submit'))
+       el.value = values[0] = '' + field_val[tests[i]];
    }
  }
 
@@ -1047,7 +1048,8 @@ document.check_form = function (form, val_hash) {
  document.load_val_hash(form, val_hash);
 
  // attach handler
- form.onsubmit = function () {return document.validate(this)};
+ var orig_submit = form.onsubmit || function () { return true };
+ form.onsubmit = function (e) { return document.validate(this) && orig_submit(e, this) };
 }
 
 // the end //
This page took 0.022854 seconds and 4 git commands to generate.