summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-county.html
diff options
context:
space:
mode:
authorivan <ivan>2009-10-12 01:45:12 +0000
committerivan <ivan>2009-10-12 01:45:12 +0000
commit0b94e40c533288be69a4fe60da36a385d31eff7f (patch)
tree8284d3c555e7b0cdfd731c567059f7f60319e3c0 /httemplate/elements/select-county.html
parent990e040448691dd4bd26c871274c65204cb7707b (diff)
UI for per-city taxes (setup and assigning to customers/package locations), RT#5852
Diffstat (limited to 'httemplate/elements/select-county.html')
-rw-r--r--httemplate/elements/select-county.html32
1 files changed, 18 insertions, 14 deletions
diff --git a/httemplate/elements/select-county.html b/httemplate/elements/select-county.html
index aa88abe..aa9f453 100644
--- a/httemplate/elements/select-county.html
+++ b/httemplate/elements/select-county.html
@@ -67,8 +67,11 @@ Example:
}
//run the callback
- if ( callback != null )
+ if ( callback != null ) {
callback();
+ } else {
+ <% $pre %>county_changed(what.form.<% $pre %>county);
+ }
}
// go get the new counties
@@ -80,7 +83,7 @@ Example:
<SELECT NAME = "<% $pre %>county"
ID = "<% $pre %>county"
- onChange= "<% $opt{'onchange'} %>"
+ onChange= "<% $onchange %>"
<% $opt{'disabled'} %>
<% $style %>
>
@@ -127,11 +130,13 @@ $opt{'disable_empty'} = 1 unless exists($opt{'disable_empty'});
my $pre = $opt{'prefix'};
+
+# disable_cityupdate?
+my $onchange =
+ ( $opt{'disable_cityupdate'} ? '' : $pre.'county_changed(this); ' ).
+ $opt{'onchange'};
+
$opt{'style'} ||= [];
-my $style =
- scalar(@{$opt{style}})
- ? 'STYLE="'. join(';', @{$opt{style}}). '"'
- : '';
my @counties = ();
if ( $countyflag ) {
@@ -139,17 +144,16 @@ if ( $countyflag ) {
@counties = map { length($_) ? $_ : $opt{'empty_data_value'} }
counties( $opt{'state'}, $opt{'country'} );
- # this is very hacky
- unless ( scalar(@counties) > 1 ) {
- if ( $opt{'disabled'} =~ /STYLE=/i ) {
- $opt{'disabled'} =~ s/STYLE="([^"]+)"/STYLE="$1; display:none"/i;
- } else {
- $opt{'disabled'} .= ' STYLE="display:none"';
- }
- }
+ push @{ $opt{'style'} }, 'display:none'
+ unless scalar(@counties) > 1;
}
+my $style =
+ scalar(@{$opt{style}})
+ ? 'STYLE="'. join(';', @{$opt{style}}). '"'
+ : '';
+
</%init>
<%once>