X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-country.html;h=286826752f279f07b5bdfb5ab921e6dddd4b708f;hb=a284ef4c8d9d43db336a77db4c34996344cd5717;hp=e5656dc0c0ce4ab256487e2f580a1ce01c922ab3;hpb=40a7b3dc653e099f7bd0bd762b649b04c4432db2;p=freeside.git
diff --git a/httemplate/elements/select-country.html b/httemplate/elements/select-country.html
index e5656dc0c..286826752 100644
--- a/httemplate/elements/select-country.html
+++ b/httemplate/elements/select-country.html
@@ -2,7 +2,7 @@
Example:
- include( '/elements/select-country.html',
+ <& /elements/select-country.html,
#recommended
country => $current_country,
@@ -14,9 +14,15 @@ Example:
empty_label => 'all', #label for empty option
disable_stateupdate => 0, #bool - disabled update of the select-state.html
style => [ 'attribute:value', 'another:value' ],
- );
+
+ state_disable_empty => 1, #defaults to 1, disable the state empty option
+ state_empty_label => 'all', #label for state empty option
+ &>
%doc>
+% #maybe this makes more sense in select-state.html?
+% # (county update is in select-county... and we wouldn't have to pass "state_"
+% # options)
% unless ( $opt{'disable_stateupdate'} ) {
<% include('/elements/xmlhttp.html',
@@ -34,6 +40,8 @@ Example:
}
function <% $pre %>country_changed(what, callback) {
+
+ what.form.<% $pre %>state.disabled = 'disabled';
country = what.options[what.selectedIndex].value;
@@ -45,12 +53,18 @@ Example:
// add the new states
var statesArray = eval('(' + states + ')' );
+% unless ( $opt{'disable_empty'} ) {
+ statesArray.unshift('', '');
+% }
+
for ( var s = 0; s < statesArray.length; s=s+2 ) {
var stateLabel = statesArray[s+1];
if ( stateLabel == "" )
- stateLabel = '(n/a)';
+ stateLabel = <% $opt{state_empty_label} || '(n/a)' |js_string %>;
opt(what.form.<% $pre %>state, statesArray[s], stateLabel);
}
+
+ what.form.<% $pre %>state.disabled = '';
//run the callback
if ( callback != null ) {
@@ -77,15 +91,13 @@ Example:
>
% unless ( $opt{'disable_empty'} ) {
-
% }
% foreach my $country ( @all_countries ) {
-
-
% }
@@ -116,7 +128,7 @@ my $default = $conf->config('countrydefault') || 'US';
my @all_countries = (
sort { ($b eq $default) <=> ($a eq $default)
- or code2country($a) cmp code2country($b)
+ or FS::geocode_Mixin->code2country($a) cmp FS::geocode_Mixin->code2country($b)
}
map { $_->country }
qsearch({