X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fcity.html;h=6a2142f29f1426df1768b83fb34f147eb740d1ca;hb=9ad0574bb99869836af00800423af7249721c1d1;hp=47e5c37c2e30737156207571d148100a740a8d01;hpb=11e7e902c43e46585ccf43e67b11ed040f6655f7;p=freeside.git
diff --git a/httemplate/elements/city.html b/httemplate/elements/city.html
index 47e5c37c2..6a2142f29 100644
--- a/httemplate/elements/city.html
+++ b/httemplate/elements/city.html
@@ -15,11 +15,20 @@ Example:
disabled => 0, #bool
# disable_empty => 1, #defaults to 1, disable the empty option
# empty_label => 'all', #label for empty option
+# disable_select => 1, # disable the selector (just show a text input)
style => [ 'attribute:value', 'another:value' ],
);
%doc>
+% if ( $disable_select ) {
+
+% }
+% else {
+
+
<% include('/elements/xmlhttp.html',
'url' => $p.'misc/cities.cgi',
'subs' => [ $pre. 'get_cities' ],
@@ -34,7 +43,7 @@ Example:
what.options[length] = optionName;
}
- var saved_<%$pre%>city= '';
+ var saved_<%$pre%>city= '<% $saved_city |h %>';
function <% $pre %>county_changed(what, callback) {
@@ -64,7 +73,7 @@ Example:
<%$pre%>city_select_changed(what.form.<% $pre %>city_select);
what.form.<% $pre %>city.style.display = 'none';
what.form.<% $pre %>city_select.style.display = '';
- } else {
+ } else if ( what.form.<% $pre %>city.style.display == 'none' ) {
// turn on the text city, turn off the select
what.form.<%$ pre %>city.value = saved_<%$pre%>city;
what.form.<% $pre %>city.style.display = '';
@@ -87,6 +96,8 @@ Example:
+% } #!disable_select
+
>
+% if ( $disable_select ) {
+%# avoid JS errors
+
+% }
+% else {
+