X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fselect-exchange.html;h=33def31b9e8ddc19eca227d8cafaedc5e6c98a3c;hp=012e7c6b7eac67a8570cbc64f113fda200f9ca4c;hb=949a80c148a8bbeeeec54c5a0be5d73b292423a5;hpb=624b2d44625f69d71175c3348cae635d580c890b diff --git a/httemplate/elements/select-exchange.html b/httemplate/elements/select-exchange.html index 012e7c6b7..33def31b9 100644 --- a/httemplate/elements/select-exchange.html +++ b/httemplate/elements/select-exchange.html @@ -17,7 +17,7 @@ what.form.<% $opt{'prefix'} %>exchange.disabled = 'disabled'; what.form.<% $opt{'prefix'} %>exchange.style.display = 'none'; var exchangewait = document.getElementById('<% $opt{'prefix'} %>exchangewait'); - exchangewait.style.display = ''; + exchangewait.style.display = 'inline'; var exchangeerror = document.getElementById('<% $opt{'prefix'} %>exchangeerror'); exchangeerror.style.display = 'none'; @@ -27,20 +27,23 @@ function <% $opt{'prefix'} %>update_exchanges(exchanges) { + var reply = JSON.parse(exchanges); // blank the current exchange for ( var i = what.form.<% $opt{'prefix'} %>exchange.length; i >= 0; i-- ) what.form.<% $opt{'prefix'} %>exchange.options[i] = null; // blank the current phonenum too for ( var i = what.form.<% $opt{'prefix'} %>phonenum.length; i >= 0; i-- ) what.form.<% $opt{'prefix'} %>phonenum.options[i] = null; - opt(what.form.<% $opt{'prefix'} %>phonenum, '', 'Select phone number'); + if ( what.form.<% $opt{'prefix'} %>phonenum.type != 'select-multiple' ) { + opt(what.form.<% $opt{'prefix'} %>phonenum, '', 'Select phone number'); + } % if ($opt{empty}) { opt(what.form.<% $opt{'prefix'} %>exchange, '', '<% $opt{empty} %>'); % } // add the new exchanges - var exchangeArray = eval('(' + exchanges + ')' ); + var exchangeArray = reply.exchanges; for ( var s = 0; s < exchangeArray.length; s++ ) { var exchangeLabel = exchangeArray[s]; if ( exchangeLabel == "" ) @@ -54,7 +57,13 @@ what.form.<% $opt{'prefix'} %>exchange.style.display = ''; } else { var exchangeerror = document.getElementById('<% $opt{'prefix'} %>exchangeerror'); - exchangeerror.style.display = ''; + exchangeerror.style.display = 'inline'; + if ( reply.error ) { + exchangeerror.textContent = reply.error; + } else { + exchangeerror.textContent = 'Select a different area code'; + } + } //run the callback @@ -71,7 +80,7 @@ - +