X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fsvc_broadband.cgi;h=a67f6f05aa3b0dbe0f3c3ed45d86887080731cec;hb=8c5a1df1a46121c75a829eb1d57956c9731940ab;hp=ae7f50fca0e80056a618e941f6e0d6e0d19e06bc;hpb=0259db6a5f67fa8837c18bbaed3e424cccf7a3e0;p=freeside.git diff --git a/httemplate/edit/svc_broadband.cgi b/httemplate/edit/svc_broadband.cgi index ae7f50fca..a67f6f05a 100644 --- a/httemplate/edit/svc_broadband.cgi +++ b/httemplate/edit/svc_broadband.cgi @@ -5,6 +5,8 @@ 'fields' => \@fields, 'field_callback' => $callback, 'dummy' => $cgi->query_string, + 'onsubmit' => 'validate_coords', + 'html_foot' => $js, ) %> <%init> @@ -17,6 +19,84 @@ die "access denied" my $conf = new FS::Conf; +my $js = < + function validate_coords(f){ +END +; +if ( $conf->exists('svc_broadband-require-nw-coordinates') ) { +$js .= < 59 ) { + s /= 1000; + } else { + s /= 60; + } + s /= 60; + + m /= 60; + if ( m > 59 ) { + alert('Invalid coordinate with minutes > 59'); + return false; + } + + var tmp = parseInt(d)+parseInt(m)+parseInt(s); + tmp = tmp.toFixed(8); + coord = (neg ? -1 : 1) * tmp; + + if(coord < lower) { + alert('Error: invalid coordinate < '+lower); + return false; + } + if(coord > upper) { + alert('Error: invalid coordinate > '+upper); + return false; + } + + return true; +END +; +} +$js .= < +END +; + my @fields = ( qw( description ip_addr speed_down speed_up blocknum ), { field=>'block_label', type=>'fixed' },