default to a session cookie instead of setting an explicit timeout, weird timezone...
[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                       'validate_fields'  => # list of key/value pairs with key being name of field to be validated and value is type
9                                     # of validation
10                                     # validation types are 
11                                     # required: true, email: true, url: true, number: true, digits: true
12                                     # validation size types are
13                                     # minlength: n, maxlength: n, rangelength: [n, n]
14                                     # validation value types are 
15                                     # min: n, max: n, range: [n, n],
16               'error_message'    => # list of key/value pairs with key being name of field to be validated and value is error
17                                     # message to display
18
19                         }
20
21    &>
22  </%doc>
23
24         </TD>
25       </TR>
26     </TABLE>
27
28 %  if ($opt{'formvalidation'}) { 
29 %    my $form_validation = $opt{'formvalidation'};
30 %    foreach my $name (sort keys %$form_validation) {
31 %      my $validate_fields = $form_validation->{$name}->{validate_fields}; 
32 %      my $error_message = $form_validation->{$name}->{error_message};
33     <script>
34       $("form[name='<% $name %>']").validate({
35         rules: {
36 %   foreach my $field (sort keys %$validate_fields) {      
37            '<%  $field %>': {
38               <% $validate_fields->{$field} %>
39            },
40 %   }
41         },
42 %   if ($error_message) {
43         messages: {
44 %     foreach my $field (sort keys %$error_message) {      
45            '<%  $field %>': "<% $error_message->{$field} %>",
46 %     }
47         },
48 %   }
49         submitHandler: function(form) {
50           form.submit();
51         }
52       });
53     </script>
54 %    } 
55 %  }
56
57   </BODY>
58 </HTML>
59
60 <%init>
61
62 my(%opt) = @_; 
63
64 </%init>