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
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
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};
34 $("form[name='<% $name %>']").validate({
36 % foreach my $field (sort keys %$validate_fields) {
38 <% $validate_fields->{$field} %>
42 % if ($error_message) {
44 % foreach my $field (sort keys %$error_message) {
45 '<% $field %>': "<% $error_message->{$field} %>",
49 submitHandler: function(form) {