diff options
-rw-r--r-- | httemplate/elements/order_pkg.js | 28 | ||||
-rwxr-xr-x | httemplate/misc/change_pkg.cgi | 9 | ||||
-rw-r--r-- | httemplate/misc/order_pkg.html | 34 |
3 files changed, 40 insertions, 31 deletions
diff --git a/httemplate/elements/order_pkg.js b/httemplate/elements/order_pkg.js new file mode 100644 index 000000000..2c13ed254 --- /dev/null +++ b/httemplate/elements/order_pkg.js @@ -0,0 +1,28 @@ +function enable_order_pkg () { + var form = document.OrderPkgForm; + var discountnum = form.discountnum; + + if ( form.pkgpart.selectedIndex > 0 ) { + form.submitButton.disabled = false; + if ( discountnum ) { + if ( form.pkgpart.options[form.pkgpart.selectedIndex].getAttribute('data-can_discount') == 1 ) { + form.discountnum.disabled = false; + } else { + form.discountnum.disabled = true; + } + } + } else { + form.submitButton.disabled = true; + if ( discountnum ) { form.discountnum.disabled = true; } + } +} + +function standardize_new_location() { + var form = document.OrderPkgForm; + var loc = form.locationnum; + if (loc.type == 'select-one' && loc.options[loc.selectedIndex].value == -1){ + standardize_locations(); + } else { + form.submit(); + } +} diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi index ec10b85cf..8f0067d2d 100755 --- a/httemplate/misc/change_pkg.cgi +++ b/httemplate/misc/change_pkg.cgi @@ -1,5 +1,7 @@ <% include('/elements/header-popup.html', "Change Package") %> +<SCRIPT TYPE="text/javascript" SRC="../elements/order_pkg.js"></SCRIPT> + <% include('/elements/error.html') %> <FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/change-cust_pkg.html" METHOD=POST> @@ -40,7 +42,12 @@ %> <BR> -<INPUT NAME="submitButton" TYPE="button" VALUE="Change package" onClick="this.disabled=true; standardize_locations();"> +<INPUT NAME = "submitButton" + TYPE = "button" + VALUE = "Change package" + onClick = "this.disabled=true; standardize_new_location();" + <% scalar($cgi->param('pkgpart')) ? '' : 'DISABLED' %> +> </FORM> </BODY> diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index 17db18714..964441aa8 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -5,33 +5,7 @@ <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT> <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT> -<SCRIPT TYPE="text/javascript"> - - function enable_order_pkg () { - if ( document.OrderPkgForm.pkgpart.selectedIndex > 0 ) { - document.OrderPkgForm.submitButton.disabled = false; - if ( document.OrderPkgForm.pkgpart.options[document.OrderPkgForm.pkgpart.selectedIndex].getAttribute('data-can_discount') == 1 ) { - document.OrderPkgForm.discountnum.disabled = false; - } else { - document.OrderPkgForm.discountnum.disabled = true; - } - } else { - document.OrderPkgForm.submitButton.disabled = true; - document.OrderPkgForm.discountnum.disabled = true; - } - } - - function standardize_new_location() { - var form = document.OrderPkgForm; - var loc = form.locationnum; - if (loc.type == 'select-one' && loc.options[loc.selectedIndex].value == -1){ - standardize_locations(); - } else { - form.submit(); - } - } - -</SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="../elements/order_pkg.js"></SCRIPT> <% include('/elements/error.html') %> @@ -148,9 +122,9 @@ % my $onclick = $cgi->param('lock_locationnum') % ? 'document.OrderPkgForm.submit()' % : 'standardize_new_location()'; -<INPUT NAME="submitButton" - TYPE="button" - VALUE="Order Package" +<INPUT NAME = "submitButton" + TYPE = "button" + VALUE = "Order Package" onClick = "this.disabled=true; <% $onclick %>;" <% $pkgpart ? '' : 'DISABLED' %> > |