fix usps-validation misfire and inability to submit on change package too, RT#12377...
[freeside.git] / httemplate / elements / order_pkg.js
1 function enable_order_pkg () {
2   var form = document.OrderPkgForm;
3   var discountnum = form.discountnum;
4
5   if ( form.pkgpart.selectedIndex > 0 ) {
6     form.submitButton.disabled = false;
7     if ( discountnum ) {
8       if ( form.pkgpart.options[form.pkgpart.selectedIndex].getAttribute('data-can_discount') == 1 ) {
9         form.discountnum.disabled = false;
10       } else {
11         form.discountnum.disabled = true;
12       }
13     }
14   } else {
15     form.submitButton.disabled = true;
16     if ( discountnum ) { form.discountnum.disabled = true; }
17   }
18 }
19
20 function standardize_new_location() {
21   var form = document.OrderPkgForm;
22   var loc = form.locationnum;
23   if (loc.type == 'select-one' && loc.options[loc.selectedIndex].value == -1){
24     standardize_locations();
25   } else {
26     form.submit();
27   }
28 }