misc: add autocompletion support for separated number and street fields (#48918)
This commit is contained in:
parent
69b9e72ad8
commit
71183a9730
|
@ -32,21 +32,26 @@ $(function() {
|
|||
} else {
|
||||
number_and_street = road;
|
||||
}
|
||||
$('#id_address').val(number_and_street);
|
||||
if ($('#id_house_number')) {
|
||||
$('#id_house_number').val(house_number);
|
||||
$('#id_address').val(road);
|
||||
} else {
|
||||
$('#id_address').val(number_and_street);
|
||||
}
|
||||
$('#id_city').val(city);
|
||||
$('#id_zipcode').val(postcode);
|
||||
}
|
||||
});
|
||||
$('#id_address, #id_city, #id_zipcode').attr('readonly', 'readonly');
|
||||
$('#id_house_number, #id_address, #id_city, #id_zipcode').attr('readonly', 'readonly');
|
||||
$('#manual-address').on('change', function() {
|
||||
$('#id_address, #id_city, #id_zipcode').attr('readonly', this.checked ? null : 'readonly');
|
||||
$('#id_house_number, #id_address, #id_city, #id_zipcode').attr('readonly', this.checked ? null : 'readonly');
|
||||
});
|
||||
if ($('#id_address').val() || $('#id_city').val() || $('#id_zipcode').val()) {
|
||||
if ($('#id_house_number').val() || $('#id_address').val() || $('#id_city').val() || $('#id_zipcode').val()) {
|
||||
var data = {
|
||||
id: 1,
|
||||
text: ''
|
||||
}
|
||||
$.each(['#id_address', '#id_zipcode', '#id_city'], function(idx, value) {
|
||||
$.each(['#id_house_number', '#id_address', '#id_zipcode', '#id_city'], function(idx, value) {
|
||||
if ($(value).val()) {
|
||||
if (data.text) {
|
||||
data.text += ' ';
|
||||
|
|
Loading…
Reference in New Issue