]> Dogcows Code - chaz/p5-CGI-Ex/blobdiff - samples/validate_js_yaml_3.html
CGI::Ex 2.23
[chaz/p5-CGI-Ex] / samples / validate_js_yaml_3.html
index 02187d1f5ecc673ae8d7effd48db75288016d02c..f4dcaa912cc608fc834f39cb3281836642118fe8 100644 (file)
@@ -27,40 +27,46 @@ if (! document.validate) {
 
 
 <form name=a validation="
-general no_confirm: 1
-general no_alert: 1
-general as_array_prefix: ' -- '
+group onevent: 'submit,change'
+group no_confirm: 1
+group no_alert: 1
+group as_array_prefix: ' -- '
 ">
-<table>
+<table border=0>
 <tr>
-  <td valign=top>Enter a date (YYYY/MM/DD) greater than today:<br>
+  <td colspan=2 valign=top>Enter a date (YYYY/MM/DD) greater than today:<br>
     (<script>var t=new Date();document.writeln(t.toGMTString())</script>)
   </td>
-  <td>
+</tr>
+<tr>
+  <td width=100>
     <input type=text size=20 name=date validation="
  name: Date
  required: 1
+ order: ['match','custom_js']
  match: 'm|^\d\d\d\d/\d\d/\d\d$|'
  match_error: 'Please enter date in YYYY/MM/DD format'
  custom_js: |
   function (args) {
+   if (args.errors.length) return 1;
    var t=new Date();
    var y=t.getYear()+1900;
    var m=t.getMonth() + 1;
    var d=t.getDate();
    if (m<10) m = '0'+m;
    if (d<10) d = '0'+d;
-   (args.value > ''+y+'/'+m+'/'+d) ? 1 : 0;
+   return (args.value > ''+y+'/'+m+'/'+d) ? 1 : 0;
   }
  custom_js_error: The date was not greater than today.
-"><br>
-    <span id=date_error class=error></span>
+">
   </td>
+  <td><span id=date_error class=error></span></td>
 </tr>
 <tr>
-  <td colspan=2 align=right>
+  <td align=right>
     <input type=submit>
   </td>
+  <td>&nbsp;</td>
 </tr>
 </table>
 </form>
This page took 0.02066 seconds and 4 git commands to generate.