summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorroot <root@debian8-7-1>2017-02-17 09:37:06 -0500
committerChristopher Burger <burgerc@freeside.biz>2017-03-21 11:15:07 -0400
commit58375f9dd75c717e46908bdfe16cab5049b25c85 (patch)
tree1b89679957912294e29eff99b8d9677434d50861 /httemplate/elements
parent6c011becce219cb693b9923d5f319a8cc5d22695 (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.html35
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