RT# 21110 Unparsable age error. Added documentation to the footer to show how to...
[freeside.git] / httemplate / elements / footer.html
1  <%doc>
2
3 Example:
4
5   <& /elements/footer.html,  
6     'formname' =>  { #actual name of the form you want validated
7                       'name'          => # name of the form
8                       'errormessage'  => # js error message to display
9                       'fieldname'     => # fieldname is actual name of field to be validated and value is type of validation
10                                          # validation types are required, valid_email, min_length(min_length[5]), max_length(max_length[7]),
11                                          # exact_length(exact_length[6]), greater_than(greater_than[4]), less_than(less_than[6]),
12                                          # alpha, alpha_numeric, numeric, valid_ip, is_file_type(is_file_type[gif,png,jpg])
13                         }
14
15    &>
16  </%doc>
17
18         </TD>
19       </TR>
20     </TABLE>
21
22 %  if ($opt{'formvalidation'}) { 
23 %    my $form_validation = $opt{'formvalidation'};
24 %    foreach my $name (sort keys $form_validation) {
25 %      my $form = $form_validation->{$name}; 
26     <script>
27       var validator = new FormValidator('<% $name %>', [
28 %      foreach my $field (sort keys $form) {      
29         {
30           name: '<%  $field %>',
31           rules: 'numeric'
32         },
33 %      }
34       ], 
35           function(errors) { 
36             if (errors.length > 0) { 
37               for (var i = 0; i<= errors.length; i++) {
38                 alert ('<% $form_validation->{$name}->{errormessage} %>');
39                   //alert ('<% $form_validation->{$name}->{errormessage} %>' + errors[i].message);
40                 return false;
41               }
42             }
43             return true;
44           }
45   );
46     </script>
47 %    } 
48 %  }
49
50   </BODY>
51 </HTML>
52
53 <%init>
54
55 my(%opt) = @_; 
56
57 </%init>