From: Stéphane Jacob Date: Sat, 11 Jun 2011 12:20:36 +0000 (+0200) Subject: Only removes locality text field if we display a locality list. X-Git-Tag: xorg/1.1.2~25 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=e0088da2881821f82f5782120c621bf7aebda36b;p=platal.git Only removes locality text field if we display a locality list. Signed-off-by: Stéphane Jacob --- diff --git a/htdocs/javascript/search.js b/htdocs/javascript/search.js index 6ad9c4a..e544410 100644 --- a/htdocs/javascript/search.js +++ b/htdocs/javascript/search.js @@ -224,15 +224,14 @@ function setAddress(i, j, values) var next_type = address_types[j]; var next_list = next_type + '_list'; - if (j == 3) { - $('tr#locality_text').hide() - $("select[name='locality_text']").attr('value', ''); - } - $('#' + next_list).load(baseurl + 'list/' + next_type, { previous:prev_type, value:values[i] }, function() { if ($("select[name='" + next_type + "']").children("option").size() > 1) { $("tr#" + next_type).show(); $("select[name='" + next_type + "']").attr('value', values[j]); + if (next_type == 'locality') { + $('tr#locality_text').hide(); + $("select[name='locality_text']").attr('value', ''); + } if (j < address_types_count) { setAddress(j, j + 1, values); }