diff options
| author | root <root@debian8-7-1> | 2017-02-17 09:37:06 -0500 |
|---|---|---|
| committer | root <root@debian8-7-1> | 2017-02-17 09:37:06 -0500 |
| commit | bf951595745feebeebc8acf91a5cf846c22c6533 (patch) | |
| tree | edfd9dbf0dd1d61d9c0f2ddcfd5d9bbc474f84f5 /httemplate/elements | |
| parent | c69e68e25b519c7f9d2ad47cb0ae6fc90c0f016c (diff) | |
RT# 21110 Unparsable age error. Added javascript to validate field prior to submitting the form. Also place checked prior entry in database.
Diffstat (limited to 'httemplate/elements')
| -rw-r--r-- | httemplate/elements/footer.html | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/httemplate/elements/footer.html b/httemplate/elements/footer.html index 32d121996..3eaa233f9 100644 --- a/httemplate/elements/footer.html +++ b/httemplate/elements/footer.html @@ -1,5 +1,40 @@ </TD> </TR> </TABLE> + +% if ($opt{'formvalidation'}) { +% my $form_validation = $opt{'formvalidation'}; +% foreach my $name (sort keys $form_validation) { +% my $form = $form_validation->{$name}; + <script> + var validator = new FormValidator('<% $name %>', [ +% foreach my $field (sort keys $form) { + { + name: '<% $field %>', + rules: 'numeric' + }, +% } + ], + function(errors) { + if (errors.length > 0) { + for (var i = 0; i<= errors.length; i++) { + alert ('<% $form_validation->{$name}->{errormessage} %>'); + //alert ('<% $form_validation->{$name}->{errormessage} %>' + errors[i].message); + return false; + } + } + return true; + } + ); + </script> +% } +% } + </BODY> </HTML> + +<%init> + +my(%opt) = @_; + +</%init>
\ No newline at end of file |
