summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorroot <root@debian8-7-1>2017-02-17 09:37:06 -0500
committerChristopher Burger <burgerc@freeside.biz>2017-05-24 12:13:48 -0400
commit2b813b0948fe96f65e40c47e92edf99314e8d25e (patch)
tree74afadd050eca90b8f699b5bfaa46f76ea371f89 /httemplate/edit
parent0f87b832ccbd061752abf034526e1c3bbf7a89ba (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/edit')
-rw-r--r--httemplate/edit/elements/edit.html15
-rw-r--r--httemplate/edit/process/part_event.html1
2 files changed, 15 insertions, 1 deletions
diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html
index 5bee7886f..285c85265 100644
--- a/httemplate/edit/elements/edit.html
+++ b/httemplate/edit/elements/edit.html
@@ -231,6 +231,7 @@ Example:
% my $url = $opt{'post_url'} || popurl(1)."process/$table.html";
+% $js_form_validate = { 'edit_topform' => { 'name' => 'edit_topform', 'errormessage' => 'Please only numeric characters ' } };
<FORM NAME = "edit_topform"
METHOD = POST
ACTION = "<% $url %>"
@@ -378,6 +379,12 @@ Example:
% $include_common{'layer_prefix'} = "$field$fieldnum."
% if $layer_prefix_on;
%
+% ## set conditionname field values for validation.
+% if ($field eq 'conditionname') {
+% my $validate_field = $field . $fieldnum . '.after_event.run_delay';
+% $js_form_validate->{edit_topform}{$validate_field} = 'numeric';
+% }
+%
% my @include =
% ( "/elements/$include.html",
% 'field' => "$field$fieldnum",
@@ -804,7 +811,11 @@ Example:
: $opt{'html_foot'}
%>
- <% include("/elements/footer.html") %>
+% my %footerdata = (
+% 'formvalidation' => $js_form_validate,
+% );
+
+ <% include("/elements/footer.html", %footerdata) %>
% }
<%init>
@@ -822,6 +833,8 @@ my $fields = $opt{'fields'}
|| [ grep { $_ ne $pkey } fields($table) ];
#my @actualfields = map { ref($_) ? $_->{'field'} : $_ } @$fields;
+my $js_form_validate = {};
+
my( $mode, $object);
my $clone = '';
if ( $opt{'embed'} ) {
diff --git a/httemplate/edit/process/part_event.html b/httemplate/edit/process/part_event.html
index 4d52e7bc6..467d69ac3 100644
--- a/httemplate/edit/process/part_event.html
+++ b/httemplate/edit/process/part_event.html
@@ -40,6 +40,7 @@
};
} elsif ( $info->{'type'} eq 'freq' ) {
$value = '0' if !length($value) and !$info->{'allow_blank'};
+ $value = '0' if $value =~ /[^\d]/;
$value .= $params->{$cgi_field.'_units'} if length($value);
}