summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-county.html
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-01-07 14:30:15 -0800
committerIvan Kohler <ivan@freeside.biz>2015-01-07 14:30:15 -0800
commitceeaad3d99869f159bf2fee490aafa4c95d03365 (patch)
treee5026eeb4204e34fe0b49fe57e0d9412a594b397 /httemplate/elements/select-county.html
parent7a577311abdb174c4a5b52bd5f0d751931097efd (diff)
add city search, RT#31659
Diffstat (limited to 'httemplate/elements/select-county.html')
-rw-r--r--httemplate/elements/select-county.html22
1 files changed, 17 insertions, 5 deletions
diff --git a/httemplate/elements/select-county.html b/httemplate/elements/select-county.html
index 058993f71..cce085f12 100644
--- a/httemplate/elements/select-county.html
+++ b/httemplate/elements/select-county.html
@@ -12,7 +12,7 @@ Example:
prefix => $optional_unique_prefix,
onchange => $javascript,
disabled => 0, #bool
- disable_empty => 1, #defaults to 1, disable the empty option
+ disable_empty => 1, #defaults to 1, set to 0 to disable the empty option
empty_label => 'all', #label for empty option
style => [ 'attribute:value', 'another:value' ],
&>
@@ -36,6 +36,8 @@ Example:
function <% $pre %>state_changed(what, callback) {
+ what.form.<% $pre %>county.disabled = 'disabled';
+
state = what.options[what.selectedIndex].value;
country = what.form.<% $pre %>country.options[what.form.<% $pre %>country.selectedIndex].value;
@@ -44,6 +46,10 @@ Example:
// blank the current county list
for ( var i = what.form.<% $pre %>county.length; i >= 0; i-- )
what.form.<% $pre %>county.options[i] = null;
+
+% unless ( $opt{disable_empty} ) {
+ opt( what.form.<% $pre %>county, '', <% $opt{empty_label} |js_string %> );
+% }
// add the new counties
var countiesArray = eval('(' + counties + ')' );
@@ -58,14 +64,20 @@ Example:
if ( countiesArray.length > 1 ) {
what.form.<% $pre %>county.style.display = '';
- //countyFormLabel.style.visibility = 'visible';
- countyFormLabel.style.display = '';
+ if ( countyFormLabel ) {
+ //countyFormLabel.style.visibility = 'visible';
+ countyFormLabel.style.display = '';
+ }
} else {
what.form.<% $pre %>county.style.display = 'none';
- //countyFormLabel.style.visibility = 'hidden';
- countyFormLabel.style.display = 'none';
+ if ( countyFormLabel ) {
+ //countyFormLabel.style.visibility = 'hidden';
+ countyFormLabel.style.display = 'none';
+ }
}
+ what.form.<% $pre %>county.disabled = '';
+
//run the callback
if ( callback != null ) {
callback();